Skip to content

Commit

Permalink
view all publications
Browse files Browse the repository at this point in the history
  • Loading branch information
rserry committed Nov 22, 2023
1 parent 261bf3e commit 8ab9135
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function manageAction()
$paginator = $this->paginator()->createFromQuery(
$this->getEntityManager()
->getRepository('PublicationBundle\Entity\Edition\Html')
->findAllByPublicationAndAcademicYearQuery($publication, $this->getCurrentAcademicYear()),
->findAllByPublicationQuery($publication, $this->getCurrentAcademicYear()),
$this->getParam('page')
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function manageAction()
$paginator = $this->paginator()->createFromQuery(
$this->getEntityManager()
->getRepository('PublicationBundle\Entity\Edition\Pdf')
->findAllByPublicationAndAcademicYearQuery($publication, $this->getCurrentAcademicYear()),
->findAllByPublicationQuery($publication, $this->getCurrentAcademicYear()),
$this->getParam('page')
);

Expand Down
15 changes: 15 additions & 0 deletions module/PublicationBundle/Repository/Edition/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ public function findAllByPublicationAndAcademicYearQuery(PublicationEntity $publ
->getQuery();
}

public function findAllByPublicationQuery(PublicationEntity $publication)
{
$query = $this->getEntityManager()->createQueryBuilder();
return $query->select('p')
->from('PublicationBundle\Entity\Edition\Html', 'p')
->where(
$query->expr()->andX(
$query->expr()->eq('p.publication', ':publication'),
)
)
->setParameter('publication', $publication)
->orderBy('p.date', 'DESC')
->getQuery();
}

public function findOneByPublicationTitleAndAcademicYear(PublicationEntity $publication, $title, AcademicYear $academicYear)
{
$query = $this->getEntityManager()->createQueryBuilder();
Expand Down
15 changes: 15 additions & 0 deletions module/PublicationBundle/Repository/Edition/Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ public function findAllByPublicationAndAcademicYearQuery(PublicationEntity $publ
->getQuery();
}

public function findAllByPublicationQuery(PublicationEntity $publication)
{
$query = $this->getEntityManager()->createQueryBuilder();
return $query->select('p')
->from('PublicationBundle\Entity\Edition\Pdf', 'p')
->where(
$query->expr()->andX(
$query->expr()->eq('p.publication', ':publication'),
)
)
->setParameter('publication', $publication)
->orderBy('p.date', 'DESC')
->getQuery();
}

public function findOneByPublicationTitleAndAcademicYear(PublicationEntity $publication, $title, AcademicYear $academicYear)
{
$query = $this->getEntityManager()->createQueryBuilder();
Expand Down

0 comments on commit 8ab9135

Please sign in to comment.