| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace AppBundle\Entity\Core\Repository;
- use AppBundle\Services\Exporter\Document;
- use Doctrine\ORM\EntityRepository;
- /**
- * Description of NotificationRepository
- *
- * @author sebastienhupin
- */
- class FileRepository extends EntityRepository {
-
- /**
- * Find notification are not viewed by the user
- *
- * @param array $ids
- *
- * @return Array
- */
- public function findByDocument(Document $document) {
- $queryBuilder = $this->createQueryBuilder('o');
- if($document->getAccess()){
- $queryBuilder
- ->innerJoin('o.accessPersons', 'p')
- ->andWhere('p.id = :person')
- ->setParameter('person', $document->getAccess()->getPerson());
- }else{
- $queryBuilder
- ->innerJoin('o.organization', 'or');
- }
- $queryBuilder
- ->andWhere('o.name = :name')
- ->andWhere('o.type = :type')
- ->setParameter('name', $document->getName())
- ->setParameter('type', $document->getType());
- return $queryBuilder->getQuery()->getResult();
- }
- }
|