public function hasDocument(Document $document)
    {
        $documentCollection = $document->getCollection();
        $documentDatabase = $documentCollection->getDatabase();

        // check connection
        if ($documentDatabase->getClient()->getDsn() !== $this->getDatabase()->getClient()->getDsn()) {
            return false;
        }

        // check database
        if ($documentDatabase->getName() !== $this->getDatabase()->getName()) {
            return false;
        }

        // check collection
        return $documentCollection->getName() == $this->getName();
    }
public function hasDocument(Document $document)
    {
        $documentCollection = $document->getCollection();
        $documentDatabase = $documentCollection->getDatabase();

        // check connection
        if ($documentDatabase->getClient()->getDsn() !== $this->getDatabase()->getClient()->getDsn()) {
            return false;
        }

        // check database
        if ($documentDatabase->getName() !== $this->getDatabase()->getName()) {
            return false;
        }

        // check collection
        return $documentCollection->getName() == $this->getName();
    }
public function hasDocument ( Document $ document ) { $ documentCollection = $ document -> getCollection ( ) ; $ documentDatabase = $ documentCollection -> getDatabase ( ) ; // check connection if ( $ documentDatabase -> getClient ( ) -> getDsn ( ) !== $ this -> getDatabase ( ) -> getClient ( ) -> getDsn ( ) ) { return false ; } // check database if ( $ documentDatabase -> getName ( ) !== $ this -> getDatabase ( ) -> getName ( ) ) { return false ; } // check collection return $ documentCollection -> getName ( ) == $ this -> getName ( ) ; }
Check if document belongs to collection

@param Document $document

@return bool
Check if document belongs to collection