Doctrine\ORM\UnitOfWork::scheduleForInsert PHP Method

scheduleForInsert() public method

If the entity already has an identifier, it will be added to the identity map.
public scheduleForInsert ( object $entity )
$entity object The entity to schedule for insertion.
    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);
        }
    }