/**
* Removes a document instance.
*
* A removed document will be removed from the database at or before transaction commit
* or as a result of the flush operation.
*
* @param object $document The document instance to remove.
*/
public function remove($document)
{
if (!is_object($document)) {
throw new \InvalidArgumentException(gettype($document));
}
$this->errorIfClosed();
$this->unitOfWork->remove($document);
}