Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [ ] Pas de régression - [x] TU/TI/TF rédigée - [x] TU/TI/TF OK - [ ] CHANGELOG modifié Reviewed-on: #53 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
35 lines
901 B
PHP
35 lines
901 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Repository;
|
|
|
|
use App\Entity\Bovine;
|
|
use App\Entity\BovineMovement;
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
use Doctrine\Persistence\ManagerRegistry;
|
|
|
|
/**
|
|
* @extends ServiceEntityRepository<BovineMovement>
|
|
*/
|
|
final class BovineMovementRepository extends ServiceEntityRepository
|
|
{
|
|
public function __construct(ManagerRegistry $registry)
|
|
{
|
|
parent::__construct($registry, BovineMovement::class);
|
|
}
|
|
|
|
public function findOpenMovement(Bovine $bovine): ?BovineMovement
|
|
{
|
|
return $this->createQueryBuilder('m')
|
|
->where('m.bovine = :bovine')
|
|
->andWhere('m.leftAt IS NULL')
|
|
->setParameter('bovine', $bovine)
|
|
->orderBy('m.enteredAt', 'DESC')
|
|
->setMaxResults(1)
|
|
->getQuery()
|
|
->getOneOrNullResult()
|
|
;
|
|
}
|
|
}
|