Shanty_Mongo_Document::createReference PHP Méthode

createReference() public méthode

Create a reference to this document
public createReference ( ) : array
Résultat 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());
    }