lib/Doctrine/ORM/UnitOfWork.php
public function scheduleForInsert($entity)
    {
        $oid = spl_object_id($entity);

        if (isset($this->entityUpdates[$oid])) {
            throw new InvalidArgumentException('Dirty entity can not be scheduled for insertion.');
        }

        if (isset($this->entityDeletions[$oid])) {
            throw ORMInvalidArgumentException::scheduleInsertForRemovedEntity($entity);
        }
        if (isset($this->originalEntityData[$oid]) && ! isset($this->entityInsertions[$oid])) {
            throw ORMInvalidArgumentException::scheduleInsertForManagedEntity($entity);
        }

        if (isset($this->entityInsertions[$oid])) {
            throw ORMInvalidArgumentException::scheduleInsertTwice($entity);
        }

        $this->entityInsertions[$oid] = $entity;

        if (isset($this->entityIdentifiers[$oid])) {
            $this->addToIdentityMap($entity);
        }

        if ($entity instanceof NotifyPropertyChanged) {
            $entity->addPropertyChangedListener($this);
        }
    }
public function scheduleForInsert($entity)
    {
        $oid = spl_object_id($entity);

        if (isset($this->entityUpdates[$oid])) {
            throw new InvalidArgumentException('Dirty entity can not be scheduled for insertion.');
        }

        if (isset($this->entityDeletions[$oid])) {
            throw ORMInvalidArgumentException::scheduleInsertForRemovedEntity($entity);
        }
        if (isset($this->originalEntityData[$oid]) && ! isset($this->entityInsertions[$oid])) {
            throw ORMInvalidArgumentException::scheduleInsertForManagedEntity($entity);
        }

        if (isset($this->entityInsertions[$oid])) {
            throw ORMInvalidArgumentException::scheduleInsertTwice($entity);
        }

        $this->entityInsertions[$oid] = $entity;

        if (isset($this->entityIdentifiers[$oid])) {
            $this->addToIdentityMap($entity);
        }

        if ($entity instanceof NotifyPropertyChanged) {
            $entity->addPropertyChangedListener($this);
        }
    }
public function scheduleForInsert ( $ entity ) { $ oid = spl_object_id ( $ entity ) ; if ( isset ( $ this -> entityUpdates [ $ oid ] ) ) { throw new InvalidArgumentException ( 'Dirty entity can not be scheduled for insertion.' ) ; } if ( isset ( $ this -> entityDeletions [ $ oid ] ) ) { throw ORMInvalidArgumentException :: scheduleInsertForRemovedEntity ( $ entity ) ; } if ( isset ( $ this -> originalEntityData [ $ oid ] ) && ! isset ( $ this -> entityInsertions [ $ oid ] ) ) { throw ORMInvalidArgumentException :: scheduleInsertForManagedEntity ( $ entity ) ; } if ( isset ( $ this -> entityInsertions [ $ oid ] ) ) { throw ORMInvalidArgumentException :: scheduleInsertTwice ( $ entity ) ; } $ this -> entityInsertions [ $ oid ] = $ entity ; if ( isset ( $ this -> entityIdentifiers [ $ oid ] ) ) { $ this -> addToIdentityMap ( $ entity ) ; } if ( $ entity instanceof NotifyPropertyChanged ) { $ entity -> addPropertyChangedListener ( $ this ) ; } }
Schedules an entity for insertion into the database.
If the entity already has an identifier, it will be added to the identity map.

@param object $entity The entity to schedule for insertion.

@throws ORMInvalidArgumentException
@throws InvalidArgumentException
Schedules an entity for insertion into the database . If the entity already has an identifier it will be added to the identity map .