<?php
namespace App\Entity\Content;
use App\Entity\Content\Common\DiscriminatorInterface;
use App\Entity\Content\Common\DiscriminatorTrait;
use App\Entity\Content\Common\Props\HeadlineTrait;
use App\Entity\Content\Common\Props\TimestampTrait;
use App\Entity\Shared\UlidIdentifiableInterface;
use App\Entity\Shared\UlidIdentifiableTrait;
use App\Model\Content\AlterationInterface;
use App\Model\Content\ContentInterface;
use App\Model\Content\ObjectInterface;
use Cms\CoreBundle\Model\Interfaces\Blameable;
use Cms\CoreBundle\Model\Interfaces\Timestampable;
use Cms\TenantBundle\Model as Tenantable;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(
* repositoryClass = "App\Doctrine\Repository\Content\AlterationRepository",
* )
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(
* name = DiscriminatorInterface::COLUMN__NAME,
* type = DiscriminatorInterface::COLUMN__TYPE,
* length = 64,
* )
* @ORM\DiscriminatorMap(AbstractAlteration::DISCRS)
* @ORM\Table(
* name = "sn__content__alteration",
* indexes = {
* @ORM\Index(
* name = "idx__discr",
* columns = {
* "discr",
* },
* ),
* },
* )
*/
abstract class AbstractAlteration
implements
Tenantable\TenantableInterface,
UlidIdentifiableInterface,
Timestampable\TimestampableInterface,
Blameable\BlameableInterface,
DiscriminatorInterface,
AlterationInterface
{
const DISCR = null;
const DISCRS = [
Alerts\Alert\AlertAlteration::DISCR => Alerts\Alert\AlertAlteration::class,
Events\Event\EventAlteration::DISCR => Events\Event\EventAlteration::class,
Exhibits\Gallery\GalleryAlteration::DISCR => Exhibits\Gallery\GalleryAlteration::class,
Exhibits\Video\VideoAlteration::DISCR => Exhibits\Video\VideoAlteration::class,
Posts\Post\PostAlteration::DISCR => Posts\Post\PostAlteration::class,
];
const CLASSES__OBJECT = null;
use Tenantable\TenantableTrait;
use UlidIdentifiableTrait;
use Timestampable\TimestampableTrait;
use Blameable\BlameableTrait;
use DiscriminatorTrait;
use HeadlineTrait;
use TimestampTrait;
/**
* @var AbstractObject|null
*/
protected ?AbstractObject $object = null;
/**
* @param ContentInterface|null $content
*/
public function __construct(?ContentInterface $content = null)
{
if ($content) {
$this->copy($content);
}
}
/**
* {@inheritDoc}
*/
public static function getObjectClass(): string
{
return static::CLASSES__OBJECT;
}
/**
* {@inheritDoc}
* @return AbstractObject
*/
public function getObject(): ?ObjectInterface
{
return $this->object;
}
/**
* {@inheritDoc}
* @param AbstractObject $object
* @return $this
*/
public function setObject(?ObjectInterface $object): self
{
$this->object = $object;
return $this;
}
}