public function scheduleForInsert(ClassMetadata $class, $document)
{
$oid = spl_object_hash($document);
if (isset($this->documentUpdates[$oid])) {
throw new \InvalidArgumentException('Dirty document can not be scheduled for insertion.');
}
if (isset($this->documentDeletions[$oid])) {
throw new \InvalidArgumentException('Removed document can not be scheduled for insertion.');
}
if (isset($this->documentInsertions[$oid])) {
throw new \InvalidArgumentException('Document can not be scheduled for insertion twice.');
}
$this->documentInsertions[$oid] = $document;
if (isset($this->documentIdentifiers[$oid])) {
$this->addToIdentityMap($document);
}
}