Doctrine\ODM\OrientDB\Mapper\Hydration\Hydrator::createDocument PHP Method

createDocument() protected method

Either tries to get the proxy
protected createDocument ( string $class, stdClass $orientObject ) : object
$class string
$orientObject stdClass
return object of type $class
    protected function createDocument($class, \stdClass $orientObject)
    {
        $metadata = $this->getMetadataFactory()->getMetadataFor($class);
        /**
         * when a record from OrientDB doesn't have a RID
         * it means it's an embedded object, which can not be
         * lazily loaded.
         */
        if (isset($orientObject->{'@rid'})) {
            $rid = new Rid($orientObject->{'@rid'});
            if ($this->getUnitOfWork()->hasProxyFor($rid)) {
                $document = $this->getUnitOfWork()->getProxyFor($rid);
            } else {
                $document = $this->getProxyFactory()->getProxy($class, array($metadata->getRidPropertyName() => $rid->getValue()));
            }
        } else {
            $class = $metadata->getName();
            $document = new $class();
        }
        $this->fill($document, $orientObject);
        return $document;
    }