src/Entity/JournalArticleTranslation.php line 35
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM,
Doctrine\DBAL\Types\Types,
Doctrine\Common\Collections\Collection,
Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping\Index;
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\SlugTrait;
use App\Enum\Language,
App\Attribute\Sanitizeable,
App\Attribute\DenormalizationPriority,
App\Repository\JournalArticleTranslationRepository;
#[ApiResource(
security: 'is_granted("' . Journal::class . '")',
operations: [ new Get() ],
extraProperties: ['standard_put' => false],
)]
#[Index(fields: ["lang"], name: "lang_idx")]
#[ORM\Entity(repositoryClass: JournalArticleTranslationRepository::class)]
class JournalArticleTranslation implements TranslationInterface
{
use IdTrait,
UuidTrait,
TimestampableTrait,
TranslationTrait,
SlugTrait;
/**
* @deprecated
* @see \App\Entity\JournalArticleMetadataTranslation
*/
#[ApiProperty(description: 'Title')]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $title = null;
#[ApiProperty(description: 'Copyrights')]
#[Groups(['read:' . self::class, 'write'])]
#[Sanitizeable]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $copyrights = null;
#[ApiProperty(description: 'Funding description')]
#[Groups(['read:' . self::class, 'write'])]
#[Sanitizeable]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $fundingDescription = null;
#[ApiProperty(description: 'Conflict of interest')]
#[Groups(['read:' . self::class, 'write'])]
#[Sanitizeable]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $conflictOfInterest = null;
#[ApiProperty(description: 'Info about author')]
#[Groups(['read:' . self::class, 'write'])]
#[Sanitizeable]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $infoAboutAuthor = null;
#[ApiProperty(description: 'Author corrections')]
#[Groups(['read:' . self::class, 'write'])]
#[Sanitizeable]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $authorCorrections = null;
#[ApiProperty(description: 'Meta title')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $metaTitle = null;
#[ApiProperty(description: 'Meta description')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $metaDescription = null;
#[ApiProperty(description: 'Meta keywords')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $metaKeywords = null;
/**
* @deprecated
* @see \App\Entity\JournalArticleMetadataTranslation
*/
#[ApiProperty(description: 'Abstract')]
#[Sanitizeable]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $abstract = null;
#[ApiProperty(description: 'Bibliography')]
#[Groups(['read:' . self::class, 'write'])]
#[Sanitizeable]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $bibliography = null;
#[ApiProperty(description: 'Old imported bibliography')]
#[Groups(['read:' . self::class, 'write'])]
#[Sanitizeable]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $oldImportedBibliography = null;
/**
* @deprecated
* @see \App\Entity\JournalArticleMetadataTranslation
*/
#[ApiProperty(description: 'Is keywords import reseting previous')]
#[DenormalizationPriority(DenormalizationPriority::TOP)]
private bool $isKeywordsImportResetingPrevious = false;
#[ApiProperty(description: 'Imported bibliography')]
#[Groups(['write'])]
private ?string $importedBibliography = null;
/**
* @deprecated
* @see \App\Entity\JournalArticleMetadataTranslation
*/
#[ApiProperty(description: 'Keywords')]
#[ORM\OneToMany(
targetEntity: JournalArticleTranslationKeyword::class,
mappedBy: 'parent',
cascade: ['persist', 'remove'],
orphanRemoval: true
)]
#[ORM\OrderBy(['ord' => 'desc'])]
private Collection $keywords;
public function __construct(JournalArticle $parent, Language $lang)
{
$this->setUuid();
$this->parent = $parent;
$this->lang = $lang;
$this->copyrights = $parent
->getIssue()
->getTranslation($lang)
?->getCopyrights();
$this->keywords = new ArrayCollection();
$this->createdAt = new \DateTimeImmutable();
$this->updatedAt = new \DateTimeImmutable();
$parent->addTranslation($this);
}
/**
* @deprecated
* @see \App\Entity\JournalArticleMetadataTranslation
*/
public function getTitle(): ?string
{
return $this->title;
}
/**
* @deprecated
* @see \App\Entity\JournalArticleMetadataTranslation
*/
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getCopyrights(): ?string
{
return $this->copyrights;
}
public function setCopyrights(?string $copyrights): self
{
$this->copyrights = $copyrights;
return $this;
}
public function getFundingDescription(): ?string
{
return $this->fundingDescription;
}
public function setFundingDescription(?string $fundingDescription): self
{
$this->fundingDescription = $fundingDescription;
return $this;
}
public function getConflictOfInterest(): ?string
{
return $this->conflictOfInterest;
}
public function setConflictOfInterest(?string $conflictOfInterest): self
{
$this->conflictOfInterest = $conflictOfInterest;
return $this;
}
public function getInfoAboutAuthor(): ?string
{
return $this->infoAboutAuthor;
}
public function setInfoAboutAuthor(?string $infoAboutAuthor): self
{
$this->infoAboutAuthor = $infoAboutAuthor;
return $this;
}
public function getAuthorCorrections(): ?string
{
return $this->authorCorrections;
}
public function setAuthorCorrections(?string $authorCorrections): self
{
$this->authorCorrections = $authorCorrections;
return $this;
}
public function getMetaTitle(): ?string
{
return $this->metaTitle;
}
public function setMetaTitle(?string $metaTitle): self
{
$this->metaTitle = $metaTitle;
return $this;
}
public function getMetaDescription(): ?string
{
return $this->metaDescription;
}
public function setMetaDescription(?string $metaDescription): self
{
$this->metaDescription = $metaDescription;
return $this;
}
public function getMetaKeywords(): ?string
{
return $this->metaKeywords;
}
public function setMetaKeywords(?string $metaKeywords): self
{
$this->metaKeywords = $metaKeywords;
return $this;
}
/**
* @deprecated
* @see \App\Entity\JournalArticleMetadataTranslation
*/
public function getAbstract(): ?string
{
return $this->abstract;
}
/**
* @deprecated
* @see \App\Entity\JournalArticleMetadataTranslation
*/
public function setAbstract(?string $abstract): self
{
$this->abstract = $abstract;
return $this;
}
public function getImportedBibliography(): ?string
{
return $this->importedBibliography;
}
public function setImportedBibliography(?string $importedBibliography): self
{
$this->importedBibliography = $importedBibliography;
return $this;
}
/**
* @deprecated
* @see \App\Entity\JournalArticleMetadataTranslation
*
* @return Collection|JournalArticleTranslationKeyword[]
*/
public function getKeywords(): Collection
{
return $this->keywords;
}
/**
* @deprecated
* @see \App\Entity\JournalArticleMetadataTranslation
*/
public function addKeyword(JournalArticleTranslationKeyword $keyword): self
{
if ($this->keywords->contains($keyword)) {
return $this;
}
$this->keywords[] = $keyword;
return $this;
}
/**
* @deprecated
* @see \App\Entity\JournalArticleMetadataTranslation
*/
public function removeKeyword(JournalArticleTranslationKeyword $keyword): self
{
$this->keywords->removeElement($keyword);
return $this;
}
/**
* @deprecated
* @see \App\Entity\JournalArticleMetadataTranslation
*/
public function resetKeywords(): self
{
$this->keywords = new ArrayCollection();
return $this;
}
public function getBibliography(): ?string
{
return $this->bibliography;
}
public function setBibliography(?string $bibliography): self
{
$this->bibliography = $bibliography;
return $this;
}
public function getOldImportedBibliography(): ?string
{
return $this->oldImportedBibliography;
}
public function setOldImportedBibliography(?string $oldImportedBibliography): self
{
$this->oldImportedBibliography = $oldImportedBibliography;
return $this;
}
public function clone(JournalArticle $parent): self
{
$clone = clone $this;
$clone->id = null;
$clone->setUuid();
$clone->parent = $parent;
$clone->parent->addTranslation($clone);
$clone->resetKeywords();
$clone->createdAt = new \DateTimeImmutable();
$clone->updatedAt = new \DateTimeImmutable();
return $clone;
}
}