<?php
namespace App\Entity\Feed\Entry;
use App\Entity\Content\AbstractObject;
use App\Entity\Content\Exhibits\Gallery\GalleryObject;
use App\Entity\Feed\AbstractEntry;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(
* repositoryClass = "App\Doctrine\Repository\Feed\Entry\ContentGalleryEntryRepository",
* )
*/
class ContentGalleryEntry extends AbstractContentEntry
{
const DISCR = 'content.'.GalleryObject::DISCR;
/**
* {@inheritDoc}
* @return GalleryObject
*/
public function getObject(): ?AbstractObject
{
if ( ! $this->object instanceof GalleryObject) {
throw new \LogicException();
}
return $this->object;
}
/**
* {@inheritDoc}
* @param GalleryObject $object
*/
public function setObject(?AbstractObject $object): self
{
if ($object && ! $object instanceof GalleryObject) {
throw new \LogicException();
}
$this->object = $object;
return $this;
}
/**
* {@inheritDoc}
* @param GalleryObject $entity
*/
public function populate($entity): self
{
if ( ! $entity instanceof GalleryObject) {
throw new \LogicException();
}
parent::populate($entity);
$this
->setLabel($entity->getHeadline())
->setMedia($entity->getMedia())
;
return $this;
}
/**
* {@inheritDoc}
*/
public function getType(): string
{
return AbstractEntry::TYPES__GALLERY;
}
}