lib/Doctrine/MongoDB/Collection.php
public function findAndRemove(array $query, array $options = [])
    {
        if ($this->eventManager->hasListeners(Events::preFindAndRemove)) {
            $eventArgs = new MutableEventArgs($this, $query, $options);
            $this->eventManager->dispatchEvent(Events::preFindAndRemove, $eventArgs);
            $query = $eventArgs->getData();
            $options = $eventArgs->getOptions();
        }

        $result = $this->doFindAndRemove($query, $options);

        if ($this->eventManager->hasListeners(Events::postFindAndRemove)) {
            $eventArgs = new MutableEventArgs($this, $result);
            $this->eventManager->dispatchEvent(Events::postFindAndRemove, $eventArgs);
            $result = $eventArgs->getData();
        }

        return $result;
    }
public function findAndRemove(array $query, array $options = [])
    {
        if ($this->eventManager->hasListeners(Events::preFindAndRemove)) {
            $eventArgs = new MutableEventArgs($this, $query, $options);
            $this->eventManager->dispatchEvent(Events::preFindAndRemove, $eventArgs);
            $query = $eventArgs->getData();
            $options = $eventArgs->getOptions();
        }

        $result = $this->doFindAndRemove($query, $options);

        if ($this->eventManager->hasListeners(Events::postFindAndRemove)) {
            $eventArgs = new MutableEventArgs($this, $result);
            $this->eventManager->dispatchEvent(Events::postFindAndRemove, $eventArgs);
            $result = $eventArgs->getData();
        }

        return $result;
    }
public function findAndRemove ( array $ query , array $ options = [ ] ) { if ( $ this -> eventManager -> hasListeners ( Events :: preFindAndRemove ) ) { $ eventArgs = new MutableEventArgs ( $ this , $ query , $ options ) ; $ this -> eventManager -> dispatchEvent ( Events :: preFindAndRemove , $ eventArgs ) ; $ query = $ eventArgs -> getData ( ) ; $ options = $ eventArgs -> getOptions ( ) ; } $ result = $ this -> doFindAndRemove ( $ query , $ options ) ; if ( $ this -> eventManager -> hasListeners ( Events :: postFindAndRemove ) ) { $ eventArgs = new MutableEventArgs ( $ this , $ result ) ; $ this -> eventManager -> dispatchEvent ( Events :: postFindAndRemove , $ eventArgs ) ; $ result = $ eventArgs -> getData ( ) ; } return $ result ; }
Invokes the findAndModify command with the remove option.

This method will dispatch preFindAndRemove and postFindAndRemove events.

@see http://docs.mongodb.org/manual/reference/command/findAndModify/
@param array $query
@param array $options
@return array|null
@throws ResultException if the command fails
Invokes the findAndModify command with the remove option .