/** * Check to see if the specification is satisfied * * @param $name * @return bool */ public function isSatisfiedBy($name) { if (!$this->repository->groupOfName($name)) { return true; } return false; }
private function recursiveObjectives($objectives, $parent, $structure) { foreach ($objectives as $obj) { $data = $obj; //$data['parent'] = $parent; $objective = $this->currRepo->objectiveOfCode($data['code']); //if not already exists in database if (!$objective) { $objective = Objective::register(new Name($data['name']), $data['code'], $structure); if ($parent) { $parent->addChild($objective); $objective->setParent($parent); } $this->manager->persist($objective); $structure->addObjective($objective); if (isset($data['level'])) { $o_levels = str_split($data['level']); //find group $i = 0; foreach ($this->cur_classlevels as $grouplevel) { $group = $this->groupRepo->groupOfName($grouplevel); $obj_level = ObjectiveControlLevel::register($group, $objective, $o_levels[$i++]); $this->manager->merge($obj_level); } } } if (isset($data['obj'])) { $this->recursiveObjectives($data['obj'], $objective, $structure); } } //$this->manager->persist($structure); if ($parent) { $this->manager->persist($parent); } }