public function scheduleForInsert($entity)
{
$oid = spl_object_hash($entity);
if (isset($this->entityUpdates[$oid])) {
throw new InvalidArgumentException("Dirty entity can not be scheduled for insertion.");
}
if (isset($this->entityDeletions[$oid])) {
throw new InvalidArgumentException("Removed entity can not be scheduled for insertion.");
}
if (isset($this->entityInsertions[$oid])) {
throw new InvalidArgumentException("Entity can not be scheduled for insertion twice.");
}
$this->entityInsertions[$oid] = $entity;
if (isset($this->entityIdentifiers[$oid])) {
$this->addToIdentityMap($entity);
}
}