Cake\Database\Query::__construct PHP Method

__construct() public method

Constructor.
public __construct ( Cake\Datasource\ConnectionInterface $connection )
$connection Cake\Datasource\ConnectionInterface The connection object to be used for transforming and executing this query
    public function __construct($connection)
    {
        $this->connection($connection);
    }

Usage Example

 /**
  * Constructor
  *
  * @param \Cake\Database\Connection $connection The connection object
  * @param \Cake\ORM\Table $table The table this query is starting on
  */
 public function __construct($connection, $table)
 {
     parent::__construct($connection);
     $this->repository($table);
     if ($this->_repository) {
         $this->addDefaultTypes($this->_repository);
     }
 }