+
+ + Last modified: {{ record.modifiedAt.format('Y-m-d') }} + at {{ record.modifiedAt.format('H:i:s') }} +
+Editor: {{ record.editor }}
+diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 3f96452..0dfcebb 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -39,6 +39,7 @@ security: - { path: ^/profile, roles: ROLE_USER } - { path: ^/bibliography, roles: ROLE_USER } - { path: ^/collection, roles: ROLE_USER } + - { path: ^/collector, roles: ROLE_USER } - { path: ^/object, roles: ROLE_USER } - { path: ^/site, roles: ROLE_USER } diff --git a/src/Controller/BibliographyController.php b/src/Controller/BibliographyController.php index ecae04f..d924407 100644 --- a/src/Controller/BibliographyController.php +++ b/src/Controller/BibliographyController.php @@ -4,6 +4,7 @@ namespace App\Controller; use App\Entity\Bibliography; use App\Entity\Collection; +use App\Entity\Collector; use App\Form\BibliographyType; //use App\Security\Voter\VocabVoter; use Doctrine\ORM\EntityManagerInterface; @@ -20,8 +21,11 @@ class BibliographyController extends AbstractController { $repo = $em->getRepository(Collection::class); $collections = $repo->findAllByBibliography($bibliography->getId()); + $repo = $em->getRepository(Collector::class); + $collectors = $repo->findAllByBibliography($bibliography->getId()); $bibliography->setCollections($collections); + $bibliography->setCollectors($collectors); return $this->render('bibliography/index.html.twig', [ 'controller_name' => 'BibliographyController', diff --git a/src/Controller/CollectorController.php b/src/Controller/CollectorController.php new file mode 100644 index 0000000..636cdac --- /dev/null +++ b/src/Controller/CollectorController.php @@ -0,0 +1,45 @@ +}', name: 'app_collector')] + public function index(Collector $collector, EntityManagerInterface $em): Response + { + $repo = $em->getRepository(Bibliography::class); + /* + $bibliographies = $repo->findAllByCollection($collector->getId()); + $collector->setBibliographies($bibliographies); + */ + + return $this->render('collector/index.html.twig', [ + 'controller_name' => 'CollectorController', + 'record' => $collector, + ]); + } + + #[Route('/collection', name: 'app_collection_landing')] + public function landing(EntityManagerInterface $em): Response + { + $repo = $em->getRepository(Collector::class); + $records = $repo->findBy([], ['modifiedAt' => 'DESC']); + $count = count($records); + + $records = array_slice($records, 0, 15); + + return $this->render('collector/landing.html.twig', [ + 'controller_name' => 'CollectorController', + 'records' => $records, + 'count' => $count, + ]); + } +} diff --git a/src/Entity/Bibliography.php b/src/Entity/Bibliography.php index 4ba1a5b..5b04f29 100644 --- a/src/Entity/Bibliography.php +++ b/src/Entity/Bibliography.php @@ -52,7 +52,11 @@ class Bibliography private DoctrineCollection $objects; - private DoctrineCollection $persons; + #[ORM\JoinTable(name: 'rel_riferimento_personaggio')] + #[ORM\JoinColumn(name: 'Bibliografia_id_bib', referencedColumnName: 'id')] + #[ORM\InverseJoinColumn(name: 'Personaggio_id_pers', referencedColumnName: 'id')] + #[ORM\ManyToMany(targetEntity: Collector::class, inversedBy: 'bibliography')] + private DoctrineCollection $collectors; private DoctrineCollection $sites; @@ -169,4 +173,16 @@ class Bibliography return $this; } + + public function getCollectors(): ?DoctrineCollection + { + return $this->collectors; + } + + public function setCollectors(DoctrineCollection $collectors): static + { + $this->collectors = $collectors; + + return $this; + } } diff --git a/src/Entity/Collection.php b/src/Entity/Collection.php index d3b0351..9a9727b 100644 --- a/src/Entity/Collection.php +++ b/src/Entity/Collection.php @@ -246,7 +246,7 @@ class Collection public function getSubjectHeadings(): ?string { - return $this->link; + return $this->subjectHeadings; } public function setSubjectHeadings(string $subjectHeadings): static diff --git a/src/Entity/Collector.php b/src/Entity/Collector.php new file mode 100644 index 0000000..8c58dfe --- /dev/null +++ b/src/Entity/Collector.php @@ -0,0 +1,294 @@ +id; + } + + public function getStatus(): ?string + { + $status = RecordStatus::tryFrom($this->status); + return $status->toString(); + } + + public function setStatus(int $status): static + { + $this->status = $status; + + return $this; + } + + public function getModifiedAt(): ?DateTimeImmutable + { + return $this->modifiedAt; + } + + public function setModifiedAt(DateTimeImmutable $modifiedAt): static + { + $this->modifiedAt = $modifiedAt; + + return $this; + } + + public function getOwner(): ?string + { + return $this->owner; + } + + public function setOwner(string $owner): static + { + $this->owner = $owner; + + return $this; + } + + public function getEditor(): ?string + { + return $this->editor; + } + + public function setEditor(string $editor): static + { + $this->editor = $editor; + + return $this; + } + + public function getCreator(): ?string + { + return $this->creator; + } + + public function setCreator(string $creator): static + { + $this->creator = $creator; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): static + { + $this->name = $name; + + return $this; + } + + public function getBirthDate(): ?string + { + return $this->birthDate; + } + + public function setBirthDate(string $birthDate): static + { + $this->birthDate = $birthDate; + + return $this; + } + + public function getDeathDate(): ?string + { + return $this->deathDate; + } + + public function setDeathDate(string $deathDate): static + { + $this->deathDate = $deathDate; + + return $this; + } + + public function getPlaces(): ?string + { + return $this->places; + } + + public function setPlaces(string $places): static + { + $this->places = $places; + + return $this; + } + + public function getDescription(): ?string + { + return $this->description; + } + + public function setDescription(string $description): static + { + $this->description = $description; + + return $this; + } + + public function getShortDescription(): ?string + { + return $this->shortDescription; + } + + public function setShortDescription(string $shortDescription): static + { + $this->shortDescription = $shortDescription; + + return $this; + } + + public function getExternalIdentifier(): ?string + { + return $this->externalIdentifier; + } + + public function setExternalIdentifier(string $externalIdentifier): static + { + $this->externalIdentifier = $externalIdentifier; + + return $this; + } + + public function getLink(): ?string + { + return $this->link; + } + + public function setLink(string $link): static + { + $this->link = $link; + + return $this; + } + + public function getSubjectHeadings(): ?string + { + return $this->subjectHeadings; + } + + public function setSubjectHeadings(string $subjectHeadings): static + { + $this->subjectHeadings = $subjectHeadings; + + return $this; + } + + public function getUri(): ?string + { + return $this->uri; + } + + public function setUri(string $uri): static + { + $this->uri = $uri; + + return $this; + } + + public function getNotes(): ?string + { + return $this->notes; + } + + public function setNotes(string $notes): static + { + $this->notes = $notes; + + return $this; + } + + public function getBibliographies(): ?DoctrineCollection + { + return $this->bibliographies; + } + + public function setBibliographies(DoctrineCollection $bibliographies): static + { + $this->bibliographies = $bibliographies; + + return $this; + } +} diff --git a/src/Repository/CollectorRepository.php b/src/Repository/CollectorRepository.php new file mode 100644 index 0000000..841823d --- /dev/null +++ b/src/Repository/CollectorRepository.php @@ -0,0 +1,45 @@ + + */ +class CollectorRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Collector::class); + } + + public function findAllByBibliography(int $biblioId): ?ArrayCollection + { + $rsm = new ResultSetMappingBuilder($this->getEntityManager()); + $rsm->addRootEntityFromClassMetadata('App\Entity\Collector', 'c'); + + $query = $this->getEntityManager()->createNativeQuery( + "SELECT + id, + stato, + editor, + nome_pers, + luoghi_att_pers + FROM collector c + JOIN rel_riferimento_personaggio + ON Personaggio_id_pers = id + WHERE Bibliografia_id_bib = :biblioId", + $rsm + ); + $query->setParameter('biblioId', $biblioId); + + $collectors = new ArrayCollection($query->getResult()); + + return $collectors; + } +} diff --git a/templates/collector/index.html.twig b/templates/collector/index.html.twig new file mode 100644 index 0000000..531eff1 --- /dev/null +++ b/templates/collector/index.html.twig @@ -0,0 +1,89 @@ +{% extends 'data_entry.html.twig' %} + +{% block title %}Collector - {{ record.name }} | ArCOA{% endblock %} + +{% block rightpanel %} +
Record ID | {{ record.id }} |
---|---|
Status | {{ record.getStatus() }} |
Editor(s) | {{ record.editor }} |
Name | {{ record.name }} |
Date of birth | {{ record.birthDate }} |
Date of death | {{ record.deathDate }} |
Places / areas of activity | {{ record.places }} |
Description | {{ record.description }} |
Short description | {{ record.shortDescription }} |
External identifier(s) | {{ record.externalIdentifier }} |
External link(s) | {{ record.link }} |
Subject headings | {{ record.subjectHeadings }} |
ArCOA URI | {{ record.uri }} |
Editorial notes | {{ record.notes }} |
Bibliographies
+ID | Status | Citation | Editor | Reference |
---|---|---|---|---|
{{ biblio.id }} | +{{ biblio.citation }} | +{{ biblio.status }} | +{{ biblio.editor }} | +{{ biblio.reference }} | +
{{ count }} result(s) found
+ID | +Title | +Status | +Editor | +Chronology | +Last modified | +Actions | +
---|---|---|---|---|---|---|
{{ record.id }} | +{{ record.title }} | +{{ record.status }} | +{{ record.owner }} | +{{ record.chronology }} | +
+ {{ record.modifiedAt.format('Y-m-d') }} + {{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }} + |
+ + | + +