/** * {@inheritDoc} * * Detaches an object from the ObjectManager * * If there are any not yet flushed changes on this object (including * removal of the object) will not be synchronized to the database. * Objects which previously referenced the detached object will continue to * reference it. * * @param object $document The object to detach. * * @throws InvalidArgumentException if $document is not an object. */ public function detach($document) { if (!is_object($document)) { throw new InvalidArgumentException('Parameter $document needs to be an object, ' . gettype($document) . ' given'); } $this->errorIfClosed(); $this->unitOfWork->detach($document); }