<?php

namespace AppBundle\Entity\Product\Repository;
use AppBundle\Entity\Organization\Organization;
use AppBundle\Entity\Person\Person;
use AppBundle\Entity\Product\Equipment;
use AppBundle\Entity\Product\EquipmentList;
use Doctrine\ORM\EntityRepository;

/**
 * Description of EquipmentRepository
 *
 */
class EquipmentRepairRepository extends EntityRepository
{

    public function findEquipmentAccessOwner(Organization $organization)
    {

        $qb = $this->createQueryBuilder('o');
        $qb->innerJoin('o.equipment', 'equ', 'WITH')
            ->innerJoin('equ.access','owner', 'WITH')
            ->innerJoin('owner.organizationFunction', 'organizationFunction')
            ->andWhere('owner.organization=:org')
            ->setParameter(':org', $organization);
        return $qb->getQuery()->getResult();
    }
}

?>
