DB\Mongo\Mapper::__construct PHP Method

__construct() public method

Instantiate class
public __construct ( Mongo $db, $collection, $fields = NULL ) : void
$db DB\Mongo object
$collection string
$fields array
return void
    function __construct(\DB\Mongo $db, $collection, $fields = NULL)
    {
        $this->db = $db;
        $this->collection = $db->selectcollection($collection);
        $this->fields = $fields;
        $this->reset();
    }

Usage Example

Beispiel #1
0
 public function __construct($collection = null)
 {
     $db = Base::instance()->get($this->connection);
     parent::__construct($db, $collection ?: $this->collection);
 }