Exemplo n.º 1
0
 /**
  * Remove skill of this object
  * through the kk_trixionary_skill_reference cross reference table.
  *
  * @param ChildSkill $skill
  * @return ChildReference The current object (for fluent API support)
  */
 public function removeSkill(ChildSkill $skill)
 {
     if ($this->getSkills()->contains($skill)) {
         $skillReference = new ChildSkillReference();
         $skillReference->setSkill($skill);
         if ($skill->isReferencesLoaded()) {
             //remove the back reference if available
             $skill->getReferences()->removeObject($this);
         }
         $skillReference->setReference($this);
         $this->removeSkillReference(clone $skillReference);
         $skillReference->clear();
         $this->collSkills->remove($this->collSkills->search($skill));
         if (null === $this->skillsScheduledForDeletion) {
             $this->skillsScheduledForDeletion = clone $this->collSkills;
             $this->skillsScheduledForDeletion->clear();
         }
         $this->skillsScheduledForDeletion->push($skill);
     }
     return $this;
 }