<?php

namespace AppBundle\Entity\Place\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * Description of PlaceRepository
 *
 */
class PlaceRepository extends EntityRepository
{
    public function findAllByOrganizationAndInternalAndOrderedByName($organization)
    {
        $queryBuilder = $this->createQueryBuilder('o');
        $queryBuilder
            ->andWhere('o.organization = :organization')
            ->andWhere('o.internal = :internal')
            ->setParameter('organization', $organization)
            ->setParameter('internal', true)
            ->orderBy('o.name')
        ;

        return $queryBuilder->getQuery()->getResult();
    }
}

