public function flush($document = null, array $options = array())
{
if (null !== $document && !is_object($document) && !is_array($document)) {
throw new \InvalidArgumentException(gettype($document));
}
$this->errorIfClosed();
$this->unitOfWork->commit($document, $options);
}