Logic for Collector entity + track ApiResource
This commit is contained in:
parent
ca48e20ce7
commit
4e52ea48f6
0
src/ApiResource/.gitignore
vendored
Normal file
0
src/ApiResource/.gitignore
vendored
Normal file
@ -16,10 +16,8 @@ class CollectorController extends AbstractController
|
||||
public function index(Collector $collector, EntityManagerInterface $em): Response
|
||||
{
|
||||
$repo = $em->getRepository(Bibliography::class);
|
||||
/*
|
||||
$bibliographies = $repo->findAllByCollection($collector->getId());
|
||||
$bibliographies = $repo->findAllByCollector($collector->getId());
|
||||
$collector->setBibliographies($bibliographies);
|
||||
*/
|
||||
|
||||
return $this->render('collector/index.html.twig', [
|
||||
'controller_name' => 'CollectorController',
|
||||
@ -27,7 +25,7 @@ class CollectorController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/collection', name: 'app_collection_landing')]
|
||||
#[Route('/collector', name: 'app_collector_landing')]
|
||||
public function landing(EntityManagerInterface $em): Response
|
||||
{
|
||||
$repo = $em->getRepository(Collector::class);
|
||||
|
@ -36,5 +36,29 @@ class BibliographyRepository extends ServiceEntityRepository
|
||||
|
||||
return $bibliographies;
|
||||
}
|
||||
}
|
||||
|
||||
public function findAllByCollector(int $collectorId): ?ArrayCollection
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
|
||||
$rsm->addRootEntityFromClassMetadata('App\Entity\Bibliography', 'b');
|
||||
|
||||
$query = $this->getEntityManager()->createNativeQuery(
|
||||
"SELECT
|
||||
id,
|
||||
stato,
|
||||
editor,
|
||||
cit_bib,
|
||||
rif_bib
|
||||
FROM bibliography b
|
||||
JOIN rel_riferimento_personaggio
|
||||
ON Bibliografia_id_bib = id
|
||||
WHERE Personaggio_id_pers = :collId",
|
||||
$rsm
|
||||
);
|
||||
$query->setParameter('collId', $collectorId);
|
||||
|
||||
$bibliographies = new ArrayCollection($query->getResult());
|
||||
|
||||
return $bibliographies;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
{% extends 'data_entry.html.twig' %}
|
||||
|
||||
{% block title %}Collection | ArCOA{% endblock %}
|
||||
{% block title %}Collector | ArCOA{% endblock %}
|
||||
|
||||
{% block rightpanel %}
|
||||
<div class="container" style="max-width: 60vw">
|
||||
<h1 class="is-size-1 mt-0 has-text-centered">Collection</h1>
|
||||
<h1 class="is-size-1 mt-0 has-text-centered">Collector</h1>
|
||||
<h2 class="is-size-3 mt-3 has-text-centered">Choose action</h2>
|
||||
|
||||
{% for message in app.flashes('notice') %}
|
||||
@ -41,20 +41,20 @@
|
||||
<table class="table is-hoverable is-fullwidth mt-5 has-text-centered results">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Title</th>
|
||||
<th>Name</th>
|
||||
<th>Status</th>
|
||||
<th>Editor</th>
|
||||
<th>Chronology</th>
|
||||
<th>Places / areas of activity</th>
|
||||
<th>Last modified</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
{% for record in records %}
|
||||
<tr>
|
||||
<td><a href="{{ path('app_collection', {'id' : record.id}) }}">{{ record.id }}</a></td>
|
||||
<td><a href="{{ path('app_collection', {'id' : record.id}) }}">{{ record.title }}</a></td>
|
||||
<td><a href="{{ path('app_collector', {'id' : record.id}) }}">{{ record.id }}</a></td>
|
||||
<td><a href="{{ path('app_collector', {'id' : record.id}) }}">{{ record.name }}</a></td>
|
||||
<td>{{ record.status }}</td>
|
||||
<td>{{ record.owner }}</td>
|
||||
<td style="max-width: 350px;">{{ record.chronology }}</td>
|
||||
<td style="max-width: 350px;">{{ record.places }}</td>
|
||||
<td>
|
||||
{{ record.modifiedAt.format('Y-m-d') }}<br>
|
||||
{{ record.editor }} at {{ record.modifiedAt.format('H:i:s') }}
|
||||
|
Loading…
Reference in New Issue
Block a user