public function createDocument(array $data = null)
    {
        $className = $this->getDocumentClassName($data);

        /* @var $document \Sokil\Mongo\Document */
        $document = new $className(
            $this,
            $data,
            array('stored' => false) + $this->definition->getOptions()
        );

        // store document to identity map
        if ($this->isDocumentPoolEnabled()) {
            $collection = $this;
            $document->onAfterInsert(function (\Sokil\Mongo\Event $event) use ($collection) {
                $collection->addDocumentToDocumentPool($event->getTarget());
            });
        }

        return $document;
    }
public function createDocument(array $data = null)
    {
        $className = $this->getDocumentClassName($data);

        /* @var $document \Sokil\Mongo\Document */
        $document = new $className(
            $this,
            $data,
            array('stored' => false) + $this->definition->getOptions()
        );

        // store document to identity map
        if ($this->isDocumentPoolEnabled()) {
            $collection = $this;
            $document->onAfterInsert(function (\Sokil\Mongo\Event $event) use ($collection) {
                $collection->addDocumentToDocumentPool($event->getTarget());
            });
        }

        return $document;
    }
public function createDocument ( array $ data = null ) { $ className = $ this -> getDocumentClassName ( $ data ) ; /* @var $document \Sokil\Mongo\Document */ $ document = new $ className ( $ this , $ data , array ( 'stored' => false ) + $ this -> definition -> getOptions ( ) ) ; // store document to identity map if ( $ this -> isDocumentPoolEnabled ( ) ) { $ collection = $ this ; $ document -> onAfterInsert ( function ( \ Sokil \ Mongo \ Event $ event ) use ( $ collection ) { $ collection -> addDocumentToDocumentPool ( $ event -> getTarget ( ) ) ; } ) ; } return $ document ; }
Factory method to get not stored Document instance from array

@param array $data

@return Document

@throws Exception
Factory method to get not stored Document instance from array