42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Repository;
|
|
|
|
use App\Entity\Childheader;
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
use Doctrine\Persistence\ManagerRegistry;
|
|
|
|
class ChildheaderRepository extends ServiceEntityRepository
|
|
{
|
|
public function __construct(ManagerRegistry $registry)
|
|
{
|
|
parent::__construct($registry, Childheader::class);
|
|
}
|
|
|
|
public function findNext($idchild, $roworder)
|
|
{
|
|
$qb = $this->createQueryBuilder('c')->select('c')->where('c.child=:idchild AND c.roworder>:roworder')
|
|
->setParameter('idchild', $idchild)
|
|
->setParameter('roworder', $roworder)
|
|
->orderby('c.roworder', 'ASC')
|
|
->setMaxResults(1);
|
|
|
|
$child = $qb->getQuery()->getOneOrNullResult();
|
|
|
|
return $child;
|
|
}
|
|
|
|
public function findPrev($idchild, $roworder)
|
|
{
|
|
$qb = $this->createQueryBuilder('c')->select('c')->where('c.child=:idchild AND c.roworder<:roworder')
|
|
->setParameter('idchild', $idchild)
|
|
->setParameter('roworder', $roworder)
|
|
->orderby('c.roworder', 'DESC')
|
|
->setMaxResults(1);
|
|
|
|
$child = $qb->getQuery()->getOneOrNullResult();
|
|
|
|
return $child;
|
|
}
|
|
}
|