예제 #1
0
파일: School.php 프로젝트: stopfstedt/ilios
 /**
  * @param DepartmentInterface $department
  */
 public function removeDepartment(DepartmentInterface $department)
 {
     $this->departments->removeElement($department);
 }
예제 #2
0
파일: School.php 프로젝트: profcab/ilios
 /**
  * @param DepartmentInterface $department
  */
 public function addDepartment(DepartmentInterface $department)
 {
     $this->departments->add($department);
 }
예제 #3
0
파일: School.php 프로젝트: Okami-/ilios
 /**
  * @return ArrayCollection|DepartmentInterface[]
  */
 public function getDepartments()
 {
     //criteria not 100% reliale on many to many relationships
     //fix in https://github.com/doctrine/doctrine2/pull/1399
     // $criteria = Criteria::create()->where(Criteria::expr()->eq("deleted", false));
     // return new ArrayCollection($this->departments->matching($criteria)->getValues());
     $arr = $this->departments->filter(function ($entity) {
         return !$entity->isDeleted();
     })->toArray();
     $reIndexed = array_values($arr);
     return new ArrayCollection($reIndexed);
 }