MongoCollection::__get PHP Method

__get() public method

Gets a collection
public __get ( string $name ) : MongoCollection
$name string The next string in the collection name.
return MongoCollection
    public function __get($name)
    {
        // Handle w and wtimeout properties that replicate data stored in $readPreference
        if ($name === 'w' || $name === 'wtimeout') {
            return $this->getWriteConcern()[$name];
        }
        return $this->db->selectCollection($this->name . '.' . str_replace(chr(0), '', $name));
    }

Usage Example

Beispiel #1
0
 /**
  * Wrapper method for MongoCollection::__get().
  *
  * @see http://php.net/manual/en/mongocollection.get.php
  * @param string $name
  * @return \MongoCollection
  */
 public function __get($name)
 {
     return $this->mongoCollection->__get($name);
 }