/** * @param Department $department * * @return $this */ public function removeDepartment($department) { $this->departmentType->deleteById($department->getId()); }
/** * @param City $city * @param Department $department */ protected function removeCity($city, $department) { $departmentId = $department->getId(); if (!isset($this->removeCities[$departmentId])) { $this->removeCities[$departmentId] = array(); } $this->removeCities[$departmentId][] = $city->getId(); }
/** * @param Department $department * @return array */ public function findNbForDepartmentAndBrand($department, $brandId = null) { $departmentId = $department; if ($department instanceof Department) { $departmentId = $department->getId(); } $qb = $this->getValidQueryBuilder()->leftJoin('ci.department', 'd')->andWhere('d.id = :department')->setParameter(':department', $departmentId)->select('COUNT(DISTINCT h.id) as nbHotels'); if ($brandId != null) { $qb->andWhere('b.id = :idBrand')->setParameter(':idBrand', $brandId); } return $qb->getQuery()->getSingleScalarResult(); }