private function createDocument($data, $document = null, $refresh = false)
    {
        if ($this->class->isLockable) {
            $lockAttribute = $this->class->getLockMetadata()->attributeName;

            if (isset($result[$lockAttribute]) && $data[$lockAttribute] === LockMode::PESSIMISTIC_WRITE) {
                throw LockException::lockFailed($data);
            }
        }

        if ($document !== null) {
            $refresh    = true;
            $identifier = $this->class->createIdentifier($data);

            $this->uow->registerManaged($document, $identifier, $data);
        }

        return $this->uow->getOrCreateDocument($this->class, $data, $document, $refresh);
    }
private function createDocument($data, $document = null, $refresh = false)
    {
        if ($this->class->isLockable) {
            $lockAttribute = $this->class->getLockMetadata()->attributeName;

            if (isset($result[$lockAttribute]) && $data[$lockAttribute] === LockMode::PESSIMISTIC_WRITE) {
                throw LockException::lockFailed($data);
            }
        }

        if ($document !== null) {
            $refresh    = true;
            $identifier = $this->class->createIdentifier($data);

            $this->uow->registerManaged($document, $identifier, $data);
        }

        return $this->uow->getOrCreateDocument($this->class, $data, $document, $refresh);
    }
private function createDocument ( $ data , $ document = null , $ refresh = false ) { if ( $ this -> class -> isLockable ) { $ lockAttribute = $ this -> class -> getLockMetadata ( ) -> attributeName ; if ( isset ( $ result [ $ lockAttribute ] ) && $ data [ $ lockAttribute ] === LockMode :: PESSIMISTIC_WRITE ) { throw LockException :: lockFailed ( $ data ) ; } } if ( $ document !== null ) { $ refresh = true ; $ identifier = $ this -> class -> createIdentifier ( $ data ) ; $ this -> uow -> registerManaged ( $ document , $ identifier , $ data ) ; } return $ this -> uow -> getOrCreateDocument ( $ this -> class , $ data , $ document , $ refresh ) ; }
Creates or fills a single document object from a query result.

@param array  $data     Raw result data from DynamoDB.
@param object $document The document object to fill, if any.
@param bool   $refresh  Refresh hint for UnitOfWork behavior.

@return object The filled and managed document object or NULL, if the
query result is empty.

@throws LockException
Creates or fills a single document object from a query result .