| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- declare(strict_types=1);
- namespace App\Repository\Organization;
- use App\Entity\Organization\Organization;
- use App\Entity\Organization\OrganizationAddressPostal;
- use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
- use Doctrine\Persistence\ManagerRegistry;
- /**
- * @method OrganizationAddressPostal|null find($id, $lockMode = null, $lockVersion = null)
- * @method OrganizationAddressPostal|null findOneBy(array $criteria, array $orderBy = null)
- * @method OrganizationAddressPostal[] findAll()
- * @method OrganizationAddressPostal[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
- */
- class OrganizationAddressPostalRepository extends ServiceEntityRepository
- {
- public function __construct(ManagerRegistry $registry)
- {
- parent::__construct($registry, OrganizationAddressPostal::class);
- }
- /**
- * Récupération des adresses postal d'une organization et d'un type précis
- * @param String $type
- * @param Organization $organization
- * @return array|null
- */
- public function getByType(String $type, Organization $organization): ?array
- {
- return $this->createQueryBuilder('organizationAddressPostal')
- ->where('organizationAddressPostal.type = :type')
- ->andWhere('organizationAddressPostal.organization = :organization')
- ->setParameter('type', $type)
- ->setParameter('organization', $organization)
- ->getQuery()
- ->getResult()
- ;
- }
- }
|