/** * @param Region $region * * @return $this */ public function removeRegion($region) { $this->regionType->deleteById($region->getId()); }
/** * @param Department $department * @param Region $region */ protected function removeDepartment($department, $region) { $regionId = $region->getId(); if (!isset($this->removeDepartments[$regionId])) { $this->removeDepartments[$regionId] = array(); } $this->removeDepartments[$regionId][] = $department->getId(); }
/** * @param Region $region * @return array */ public function findNbForRegionAndBrand($region, $brandId = null) { $regionId = $region; if ($region instanceof Region) { $regionId = $region->getId(); } $qb = $this->getValidQueryBuilder()->andWhere('r.id = :region')->setParameter(':region', $regionId)->select('COUNT(DISTINCT h.id) as nbHotels'); if ($brandId != null) { $qb->andWhere('b.id = :idBrand')->setParameter(':idBrand', $brandId); } return $qb->getQuery()->getSingleScalarResult(); }