BillRepository.php 743 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace AppBundle\Entity\Billing\Repository;
  3. use AppBundle\Entity\Organization\Organization;
  4. use Doctrine\ORM\EntityRepository;
  5. /**
  6. * Class BillRepository
  7. * @package AppBundle\Entity\AccessAndFunction\Repository
  8. */
  9. class BillRepository extends EntityRepository
  10. {
  11. public function findMaxBNumberByOrganization(Organization $organization)
  12. {
  13. $qb = $this->createQueryBuilder('b');
  14. $qb->select('max(b.billNumberInteger) as billNumber')
  15. ->join('b.access','acc')
  16. ->andWhere('acc.organization=:org')
  17. ->orderBy('b.id', 'DESC')
  18. ->setParameter(':org',$organization)
  19. ->setMaxResults(1);
  20. return $qb->getQuery()->getOneOrNullResult();
  21. }
  22. }
  23. ?>