mirror of
https://github.com/openvk/openvk
synced 2024-11-15 11:39:13 +03:00
28 lines
668 B
PHP
28 lines
668 B
PHP
|
<?php declare(strict_types=1);
|
||
|
namespace openvk\Web\Models\Entities;
|
||
|
|
||
|
class Comment extends Post
|
||
|
{
|
||
|
protected $tableName = "comments";
|
||
|
protected $upperNodeReferenceColumnName = "owner";
|
||
|
|
||
|
function getPrettyId(): string
|
||
|
{
|
||
|
return $this->getRecord()->id;
|
||
|
}
|
||
|
|
||
|
function getVirtualId(): int
|
||
|
{
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
function getTarget(): ?Postable
|
||
|
{
|
||
|
$entityClassName = $this->getRecord()->model;
|
||
|
$repoClassName = str_replace("Entities", "Repositories", $entityClassName) . "s";
|
||
|
$entity = (new $repoClassName)->get($this->getRecord()->target);
|
||
|
|
||
|
return $entity;
|
||
|
}
|
||
|
}
|