/** * Remove rights of this object * through the R_rights_forformat cross reference table. * * @param ChildRights $rights * @return ChildFormats The current object (for fluent API support) */ public function removeRights(ChildRights $rights) { if ($this->getRightss()->contains($rights)) { $rRightsForformat = new ChildRRightsForformat(); $rRightsForformat->setRights($rights); if ($rights->isFormatssLoaded()) { //remove the back reference if available $rights->getFormatss()->removeObject($this); } $rRightsForformat->setFormats($this); $this->removeRRightsForformat(clone $rRightsForformat); $rRightsForformat->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; }