src/Entity/JournalTranslation.php line 33
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM,
Doctrine\DBAL\Types\Types;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Metadata\ApiProperty,
ApiPlatform\Metadata\ApiResource,
ApiPlatform\Metadata\Get;
use App\Entity\Interface\TranslationInterface,
App\Entity\Trait\IdTrait,
App\Entity\Trait\UuidTrait,
App\Entity\Trait\TimestampableTrait,
App\Entity\Trait\TranslationTrait,
App\Entity\Trait\SEOTrait,
App\Entity\Trait\Media\SetMediaTrait;
use App\Enum\Language,
App\Entity\Media,
App\Repository\JournalTranslationRepository;
use App\Validator\Constraints as CustomAssert;
#[ApiResource(
security: 'is_granted("' . Journal::class . '")',
operations: [ new Get() ],
extraProperties: ['standard_put' => false],
)]
#[ORM\Entity(repositoryClass: JournalTranslationRepository::class)]
class JournalTranslation implements TranslationInterface
{
use IdTrait,
UuidTrait,
TimestampableTrait,
TranslationTrait,
SEOTrait,
SetMediaTrait;
#[ApiProperty(description: 'Title')]
#[Groups(['read', 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $title = null;
#[ApiProperty(description: 'Title sort key')]
#[Groups(['read:' . self::class])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $titleSortKey = null;
#[ApiProperty(description: 'Subtitle')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $subtitle = null;
#[ApiProperty(description: 'Cover', writableLink: false)]
#[Groups(['read:' . self::class, 'write'])]
#[CustomAssert\ValidMediaMimeType(types: ['image/*'])]
#[ORM\ManyToOne(targetEntity: Media::class, cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(onDelete: 'set null')]
private ?Media $cover = null;
#[ApiProperty(description: 'Cover photo alt text')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $coverAlt = null;
#[ApiProperty(description: 'Page header title')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $pageHeaderTitle = null;
#[ApiProperty(description: 'Alert A: message')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 1023, nullable: true)]
private ?string $alertAMessage = null;
#[ApiProperty(description: 'Alert A: link')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $alertALink = null;
#[ApiProperty(description: 'Alert B: message')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 1023, nullable: true)]
private ?string $alertBMessage = null;
#[ApiProperty(description: 'Alert B: link')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $alertBLink = null;
#[ApiProperty(description: 'Logo', writableLink: false)]
#[Groups(['read:' . self::class, 'write'])]
#[CustomAssert\ValidMediaMimeType(types: ['image/*'])]
#[ORM\ManyToOne(targetEntity: Media::class, cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(onDelete: 'set null')]
private ?Media $logo = null;
#[ApiProperty(description: 'Logo photo alt text')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $logoAlt = null;
#[ApiProperty(description: 'Affiliation logo', writableLink: false)]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\ManyToOne(targetEntity: Media::class, cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(onDelete: 'set null')]
private ?Media $affiliationLogo = null;
#[ApiProperty(description: 'Affiliation logo photo alt text')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $affiliationLogoAlt = null;
#[ApiProperty(description: 'Affiliation text')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $affiliationText = null;
#[ApiProperty(description: 'Footer column A title')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $footerColumnATitle = null;
#[ApiProperty(description: 'Footer column A text')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $footerColumnAText = null;
#[ApiProperty(description: 'Footer column B title')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $footerColumnBTitle = null;
#[ApiProperty(description: 'Footer column B text')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $footerColumnBText = null;
#[ApiProperty(description: 'Footer column C title')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $footerColumnCTitle = null;
#[ApiProperty(description: 'Footer column C text')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $footerColumnCText = null;
#[ApiProperty(description: 'Footer column D title')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $footerColumnDTitle = null;
#[ApiProperty(description: 'Footer column D text')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $footerColumnDText = null;
#[ApiProperty(description: 'Additional section info')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $additionalSectionInfo = null;
public function __construct(Journal $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;
$collator = new \Collator($this->lang->value);
$this->titleSortKey = bin2hex($collator->getSortKey($title));
/** @var Journal */
$parent = $this->parent;
if ($this->lang === $parent->getNativeLanguage()) {
$parent
->setNativeTitle($title)
->setNativeTitleSortKey($this->titleSortKey);
}
return $this;
}
public function getTitleSortKey(): ?string
{
return $this->titleSortKey;
}
public function getSubtitle(): ?string
{
return $this->subtitle;
}
public function setSubtitle(?string $subtitle): self
{
$this->subtitle = $subtitle;
return $this;
}
public function getCover(): ?Media
{
return $this->cover;
}
public function setCover(?Media $cover): self
{
return $this->setMedia('cover', $cover);
}
public function getCoverAlt(): ?string
{
return $this->coverAlt;
}
public function setCoverAlt(?string $coverAlt): self
{
$this->coverAlt = $coverAlt;
return $this;
}
public function getPageHeaderTitle(): ?string
{
return $this->pageHeaderTitle;
}
public function setPageHeaderTitle(?string $pageHeaderTitle): self
{
$this->pageHeaderTitle = $pageHeaderTitle;
return $this;
}
public function getAlertAMessage(): ?string
{
return $this->alertAMessage;
}
public function setAlertAMessage(?string $alertAMessage): self
{
$this->alertAMessage = $alertAMessage;
return $this;
}
public function getAlertALink(): ?string
{
return $this->alertALink;
}
public function setAlertALink(?string $alertALink): self
{
$this->alertALink = $alertALink;
return $this;
}
public function getAlertBMessage(): ?string
{
return $this->alertBMessage;
}
public function setAlertBMessage(?string $alertBMessage): self
{
$this->alertBMessage = $alertBMessage;
return $this;
}
public function getAlertBLink(): ?string
{
return $this->alertBLink;
}
public function setAlertBLink(?string $alertBLink): self
{
$this->alertBLink = $alertBLink;
return $this;
}
public function getLogo(): ?Media
{
return $this->logo;
}
public function setLogo(?Media $logo): self
{
return $this->setMedia('logo', $logo);
}
public function getLogoAlt(): ?string
{
return $this->logoAlt;
}
public function setLogoAlt(?string $logoAlt): self
{
$this->logoAlt = $logoAlt;
return $this;
}
public function getAffiliationLogo(): ?Media
{
return $this->affiliationLogo;
}
public function setAffiliationLogo(?Media $affiliationLogo): self
{
return $this->setMedia('affiliationLogo', $affiliationLogo);
return $this;
}
public function getAffiliationLogoAlt(): ?string
{
return $this->affiliationLogoAlt;
}
public function setAffiliationLogoAlt(?string $affiliationLogoAlt): self
{
$this->affiliationLogoAlt = $affiliationLogoAlt;
return $this;
}
public function getAffiliationText(): ?string
{
return $this->affiliationText;
}
public function setAffiliationText(?string $affiliationText): self
{
$this->affiliationText = $affiliationText;
return $this;
}
public function getFooterColumnATitle(): ?string
{
return $this->footerColumnATitle;
}
public function setFooterColumnATitle(?string $footerColumnATitle): self
{
$this->footerColumnATitle = $footerColumnATitle;
return $this;
}
public function getFooterColumnAText(): ?string
{
return $this->footerColumnAText;
}
public function setFooterColumnAText(?string $footerColumnAText): self
{
$this->footerColumnAText = $footerColumnAText;
return $this;
}
public function getFooterColumnBTitle(): ?string
{
return $this->footerColumnBTitle;
}
public function setFooterColumnBTitle(?string $footerColumnBTitle): self
{
$this->footerColumnBTitle = $footerColumnBTitle;
return $this;
}
public function getFooterColumnBText(): ?string
{
return $this->footerColumnBText;
}
public function setFooterColumnBText(?string $footerColumnBText): self
{
$this->footerColumnBText = $footerColumnBText;
return $this;
}
public function getFooterColumnCTitle(): ?string
{
return $this->footerColumnCTitle;
}
public function setFooterColumnCTitle(?string $footerColumnCTitle): self
{
$this->footerColumnCTitle = $footerColumnCTitle;
return $this;
}
public function getFooterColumnCText(): ?string
{
return $this->footerColumnCText;
}
public function setFooterColumnCText(?string $footerColumnCText): self
{
$this->footerColumnCText = $footerColumnCText;
return $this;
}
public function getFooterColumnDTitle(): ?string
{
return $this->footerColumnDTitle;
}
public function setFooterColumnDTitle(?string $footerColumnDTitle): self
{
$this->footerColumnDTitle = $footerColumnDTitle;
return $this;
}
public function getFooterColumnDText(): ?string
{
return $this->footerColumnDText;
}
public function setFooterColumnDText(?string $footerColumnDText): self
{
$this->footerColumnDText = $footerColumnDText;
return $this;
}
public function getAdditionalSectionInfo(): ?string
{
return $this->additionalSectionInfo;
}
public function setAdditionalSectionInfo(?string $additionalSectionInfo): self
{
$this->additionalSectionInfo = $additionalSectionInfo;
return $this;
}
public function clone(Journal $parent): self
{
$clone = clone $this;
$clone->id = null;
$clone->setUuid();
if ($clone->cover) {
$clone->cover = $this->cover->clone();
$clone->cover->setRelated(self::class . ':' . $clone->uuid->toString());
}
if ($clone->logo) {
$clone->logo = $this->logo->clone();
$clone->logo->setRelated(self::class . ':' . $clone->uuid->toString());
}
if ($clone->affiliationLogo) {
$clone->affiliationLogo = $this->logo->clone();
$clone->affiliationLogo->setRelated(self::class . ':' . $clone->uuid->toString());
}
$clone->parent = $parent;
$clone->parent->addTranslation($clone);
$clone->createdAt = new \DateTimeImmutable();
$clone->updatedAt = new \DateTimeImmutable();
return $clone;
}
}