public function scheduleForInsert(ClassMetadata $class, object $document) : void
    {
        $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])) {
            return;
        }

        $this->addToIdentityMap($document);
    }
public function scheduleForInsert(ClassMetadata $class, object $document) : void
    {
        $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])) {
            return;
        }

        $this->addToIdentityMap($document);
    }
public function scheduleForInsert ( ClassMetadata $ class , object $ document ) : void { $ 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 ] ) ) { return ; } $ this -> addToIdentityMap ( $ document ) ; }
Schedules a document for insertion into the database.
If the document already has an identifier, it will be added to the
identity map.

@internal

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