Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo::invokeLifecycleCallbacks PHP Method

invokeLifecycleCallbacks() public method

Dispatches the lifecycle event of the given document by invoking all registered callbacks.
public invokeLifecycleCallbacks ( string $event, object $document, array $arguments = null )
$event string Lifecycle event
$document object Document on which the event occurred
$arguments array Arguments to pass to all callbacks
    public function invokeLifecycleCallbacks($event, $document, array $arguments = null)
    {
        if (!$document instanceof $this->name) {
            throw new \InvalidArgumentException(sprintf('Expected document class "%s"; found: "%s"', $this->name, get_class($document)));
        }
        if (empty($this->lifecycleCallbacks[$event])) {
            return;
        }
        foreach ($this->lifecycleCallbacks[$event] as $callback) {
            if ($arguments !== null) {
                call_user_func_array(array($document, $callback), $arguments);
            } else {
                $document->{$callback}();
            }
        }
    }
ClassMetadataInfo