src/Entity/FooterMenuGroupItemTranslation.php line 28
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM,
Doctrine\DBAL\Types\Types;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Metadata\ApiResource,
ApiPlatform\Metadata\ApiProperty,
ApiPlatform\Metadata\Get;
use App\Entity\Trait\IdTrait,
App\Entity\Trait\UuidTrait,
App\Entity\Trait\TimestampableTrait,
App\Entity\Trait\TranslationTrait,
App\Entity\Interface\TranslationInterface,
App\Enum\Language;
use App\Repository\FooterMenuGroupItemTranslationRepository;
#[ApiResource(
security: 'is_granted("' . FooterMenuGroup::class . '")',
operations: [ new Get() ],
extraProperties: ['standard_put' => false],
)]
#[ORM\Entity(repositoryClass: FooterMenuGroupItemTranslationRepository::class)]
class FooterMenuGroupItemTranslation implements TranslationInterface
{
use IdTrait,
UuidTrait,
TimestampableTrait,
TranslationTrait;
#[ApiProperty(description: 'Title')]
#[Groups(['read', 'write'])]
#[ORM\Column(type: Types::STRING, length: 511, nullable: true)]
private ?string $title = null;
#[ApiProperty(description: 'Link')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 1023, nullable: true)]
private ?string $link = null;
#[ApiProperty(description: 'Page', writableLink: false)]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\ManyToOne(targetEntity: Page::class)]
#[ORM\JoinColumn(onDelete: 'set null')]
private ?Page $page = null;
public function __construct(FooterMenuGroupItem $parent, Language $lang)
{
$this->setUuid();
$this->parent = $parent;
$this->lang = $lang;
$this->createdAt = new \DateTimeImmutable();
$this->updatedAt = new \DateTimeImmutable();
$parent->addTranslation($this);
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getLink(): ?string
{
return $this->link;
}
public function setLink(?string $link): self
{
if (empty($link)) {
$this->page = null;
}
$this->link = $link;
return $this;
}
public function getPage(): ?Page
{
return $this->page;
}
public function setPage(?Page $page): self
{
if ($page) {
$this->link = null;
}
$this->page = $page;
return $this;
}
public function getIsLinkable(): bool
{
return ! empty($this->link) || $this->page !== null;
}
}