Shanty_Mongo_Document::createReference PHP 메소드

createReference() 공개 메소드

Create a reference to this document
public createReference ( ) : array
리턴 array
    public function createReference()
    {
        if (!$this->isRootDocument()) {
            require_once 'Shanty/Mongo/Exception.php';
            throw new Shanty_Mongo_Exception('Can not create reference. Document is not a root document');
        }
        if (!$this->isConnected()) {
            require_once 'Shanty/Mongo/Exception.php';
            throw new Shanty_Mongo_Exception('Can not create reference. Document does not connected to a db and collection');
        }
        return MongoDBRef::create($this->getConfigAttribute('collection'), $this->getId());
    }