예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function buildQuery(QueryBuilder $queryBuilder, array $values = array())
 {
     if (!array_key_exists($this->getName(), $values) || 0 === count($values[$this->getName()])) {
         return;
     }
     $codes = $values[$this->getName()];
     if (in_array('all_but_paris', $codes)) {
         $departements = new Departments();
         $regions = new Regions();
         unset($codes[array_search('all_but_paris', $codes)]);
         $codes = array_merge($codes, array_diff(array_keys($departements->getArrayCopy()), $regions->get(self::ALL_BUT_PARIS_REGION_CODE)->getCodesDepartements()));
     }
     if (count($codes)) {
         $queryBuilder->setParameter('department', $codes, Connection::PARAM_STR_ARRAY)->andWhere('response.companyDepartment IN(:department)');
     }
 }
예제 #2
0
 public function testGetLabel()
 {
     $collection = new TestedClass();
     $this->object($region = $collection->get('11'))->isInstanceOf('agallou\\Regions\\Region')->string($region->getLabel())->isEqualTo('Ile-de-France')->array($collection->getArrayCopy())->hasKey('11')->hasSize(27);
 }