src/Entity/JournalArticleBibliographyEntry.php line 57
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM,
Doctrine\DBAL\Types\Types,
Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Serializer\Annotation\Groups,
Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Metadata\ApiResource,
ApiPlatform\Metadata\ApiProperty,
ApiPlatform\Metadata\Get,
ApiPlatform\Metadata\GetCollection,
ApiPlatform\Metadata\Post,
ApiPlatform\Metadata\Put,
ApiPlatform\Metadata\Delete,
ApiPlatform\Metadata\ApiFilter,
ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
use App\Entity\Trait\IdTrait,
App\Entity\Trait\UuidTrait,
App\Entity\Trait\OrdTrait,
App\Entity\Trait\TimestampableTrait,
App\Entity\Trait\TranslatableTrait,
App\Entity\Trait\Languages\LanguageableChildTrait,
App\Entity\Interface\TranslatableInterface,
App\Entity\Interface\OrderableInterface,
App\Entity\Interface\LanguageableChildInterface;
use App\Filter\IriFilter,
App\Repository\JournalArticleBibliographyEntryRepository;
#[ApiResource(
description: 'Journal article bibliography entries',
normalizationContext: ['groups' => [
'read',
'read:' . self::class,
'read:' . self::class . 'Translation'
]],
denormalizationContext: ['groups' => ['write']],
security: 'is_granted("' . Journal::class . '")',
order: ['ord' => 'desc'],
operations: [
new GetCollection(),
new GetCollection(uriTemplate: '/journal_article_bibliography_entries_all', paginationEnabled: false),
new Post(denormalizationContext: ['groups' => ['write', 'post']]),
new Get(),
new Put(),
new Delete(),
],
extraProperties: ['standard_put' => false],
)]
#[ApiFilter(IriFilter::class, properties: ['parent'])]
#[ApiFilter(OrderFilter::class, properties: ['ord'])]
#[ORM\Entity(repositoryClass: JournalArticleBibliographyEntryRepository::class)]
class JournalArticleBibliographyEntry implements TranslatableInterface, OrderableInterface, LanguageableChildInterface
{
use IdTrait,
UuidTrait,
OrdTrait,
TimestampableTrait,
TranslatableTrait,
LanguageableChildTrait;
#[ApiProperty(description: 'Parent', readableLink: false, writableLink: false)]
#[Groups(['read', 'post'])]
#[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: JournalArticle::class, inversedBy: 'bibliographyEntries')]
#[ORM\JoinColumn(onDelete: 'cascade', nullable: false)]
private JournalArticle $parent;
#[ApiProperty(description: 'DOI')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $doi = null;
#[ApiProperty(description: 'Article number')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $articleNumber = null;
#[ApiProperty(description: 'PubMed')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $pubMed = null;
#[ApiProperty(description: 'PubMed Central')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $pubMedCentral = null;
#[ApiProperty(description: 'Google scholar')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $googleScholar = null;
#[ApiProperty(description: 'Is header')]
#[Groups(['read:' . self::class, 'write'])]
#[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])]
protected bool $isHeader = false;
public function __construct(JournalArticle $parent)
{
$this->setUuid();
$this->parent = $parent;
$this->translations = new ArrayCollection();
foreach ($this->getParentLanguages() as $lang) {
new JournalArticleBibliographyEntryTranslation($this, $lang);
}
$this->createdAt = new \DateTimeImmutable();
$this->updatedAt = new \DateTimeImmutable();
$parent->addBibliographyEntry($this);
}
public function getParent(): JournalArticle
{
return $this->parent;
}
public function getDoi(): ?string
{
return $this->doi;
}
public function setDoi(?string $doi): self
{
$this->doi = $doi;
return $this;
}
public function getArticleNumber(): ?string
{
return $this->articleNumber;
}
public function setArticleNumber(?string $articleNumber): self
{
$this->articleNumber = $articleNumber;
return $this;
}
public function getPubMed(): ?string
{
//https://pubmed.ncbi.nlm.nih.gov/?term=
return $this->pubMed;
}
public function setPubMed(?string $pubMed): self
{
$this->pubMed = $pubMed;
return $this;
}
public function getPubMedCentral(): ?string
{
//https://www.ncbi.nlm.nih.gov/pmc/?term=
return $this->pubMedCentral;
}
public function setPubMedCentral(?string $pubMedCentral): self
{
$this->pubMedCentral = $pubMedCentral;
return $this;
}
public function getGoogleScholar(): ?string
{
//https://scholar.google.com/scholar?q=
return $this->googleScholar;
}
public function setGoogleScholar(?string $googleScholar): self
{
$this->googleScholar = $googleScholar;
return $this;
}
public function setIsHeader(bool $isHeader): self
{
$this->isHeader = $isHeader;
return $this;
}
public function getIsHeader(): bool
{
return $this->isHeader;
}
}