Example #1
0
 /**
  * @param  ChildIdentity $identity The ChildIdentity object to remove.
  * @return $this|ChildUser The current object (for fluent API support)
  */
 public function removeIdentity(ChildIdentity $identity)
 {
     if ($this->getIdentities()->contains($identity)) {
         $pos = $this->collIdentities->search($identity);
         $this->collIdentities->remove($pos);
         if (null === $this->identitiesScheduledForDeletion) {
             $this->identitiesScheduledForDeletion = clone $this->collIdentities;
             $this->identitiesScheduledForDeletion->clear();
         }
         $this->identitiesScheduledForDeletion[] = clone $identity;
         $identity->setUser(null);
     }
     return $this;
 }