/**
* {@inheritDoc}
*
* No PHPCR node will be created yet, this only happens on flush.
*
* For translatable documents has to determine the locale:
*
* - If there is a non-empty Locale mapping that field value is used
* - If the document was previously loaded from the DocumentManager it
* has a non-empty Locale mapping
* - Otherwise its a new document. The language chooser strategy is asked
* for the default language and that is used to store. The field is
* updated with the locale.
*
* @param object $document the document to persist
*
* @throws InvalidArgumentException if $document is not an object.
*/
public function persist($document)
{
if (!is_object($document)) {
throw new InvalidArgumentException('Parameter $document needs to be an object, ' . gettype($document) . ' given');
}
$this->errorIfClosed();
$this->unitOfWork->scheduleInsert($document);
}