/** * Remove rights of this object * through the R_rights_fortemplate cross reference table. * * @param ChildRights $rights * @return ChildTemplatenames The current object (for fluent API support) */ public function removeRights(ChildRights $rights) { if ($this->getRightss()->contains($rights)) { $rRightsFortemplate = new ChildRRightsFortemplate(); $rRightsFortemplate->setRights($rights); if ($rights->isTemplatenamessLoaded()) { //remove the back reference if available $rights->getTemplatenamess()->removeObject($this); } $rRightsFortemplate->setTemplatenames($this); $this->removeRRightsFortemplate(clone $rRightsFortemplate); $rRightsFortemplate->clear(); $this->collRightss->remove($this->collRightss->search($rights)); if (null === $this->rightssScheduledForDeletion) { $this->rightssScheduledForDeletion = clone $this->collRightss; $this->rightssScheduledForDeletion->clear(); } $this->rightssScheduledForDeletion->push($rights); } return $this; }