Doctrine\Common\Collections\ArrayCollection::removeElement PHP Method

removeElement() public method

{@inheritDoc}
public removeElement ( $element )
    public function removeElement($element)
    {
        $key = array_search($element, $this->elements, true);
        if ($key === false) {
            return false;
        }
        unset($this->elements[$key]);
        return true;
    }

Usage Example

 /**
  * @param Deputy $deputy
  * @return HasDeputiesInterface
  */
 public function removeDeputy(Deputy $deputy)
 {
     if (true === $this->hasDeputy($deputy)) {
         $this->deputies->removeElement($deputy);
     }
     return $this;
 }
All Usage Examples Of Doctrine\Common\Collections\ArrayCollection::removeElement