示例#1
0
 /**
  * Remove rights of this object
  * through the R_rights_foruser cross reference table.
  *
  * @param ChildRights $rights
  * @return ChildUsers The current object (for fluent API support)
  */
 public function removeRights(ChildRights $rights)
 {
     if ($this->getRightss()->contains($rights)) {
         $rRightsForuser = new ChildRRightsForuser();
         $rRightsForuser->setRights($rights);
         if ($rights->isUserssLoaded()) {
             //remove the back reference if available
             $rights->getUserss()->removeObject($this);
         }
         $rRightsForuser->setUsers($this);
         $this->removeRRightsForuser(clone $rRightsForuser);
         $rRightsForuser->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;
 }