Doctrine\ODM\PHPCR\UnitOfWork::doScheduleInsert PHP Method

doScheduleInsert() private method

private doScheduleInsert ( $document, &$visited, $overrideIdGenerator = null )
    private function doScheduleInsert($document, &$visited, $overrideIdGenerator = null)
    {
        if (!is_object($document)) {
            throw new PHPCRException(sprintf('Expected a mapped object, found <%s>', gettype($document)));
        }
        $oid = spl_object_hash($document);
        // To avoid recursion loops (over children and parents)
        if (isset($visited[$oid])) {
            return;
        }
        $visited[$oid] = true;
        $class = $this->dm->getClassMetadata(get_class($document));
        if ($class->isMappedSuperclass) {
            throw new InvalidArgumentException('Cannot persist a mapped super class instance: ' . $class->name);
        }
        $this->cascadeScheduleParentInsert($class, $document, $visited);
        $state = $this->getDocumentState($document);
        switch ($state) {
            case self::STATE_NEW:
                $this->persistNew($class, $document, $overrideIdGenerator);
                break;
            case self::STATE_MANAGED:
                // TODO: Change Tracking Deferred Explicit
                break;
            case self::STATE_REMOVED:
                unset($this->scheduledRemovals[$oid]);
                $this->setDocumentState($oid, self::STATE_MANAGED);
                break;
            case self::STATE_DETACHED:
                throw new InvalidArgumentException('Detached document or new document with already existing id passed to persist(): ' . self::objToStr($document, $this->dm));
            case self::STATE_FROZEN:
                throw new InvalidArgumentException('Document versions cannot be persisted: ' . self::objToStr($document, $this->dm));
        }
        $this->cascadeScheduleInsert($class, $document, $visited);
    }
UnitOfWork