public function __construct(string $table, Connection $connection = null) { $this->table = $table; $this->connection = $connection ?? Connection::getConnection(); if ($this->connection === null) { throw new \InvalidArgumentException('Could not establish connection to database'); } }
private function __construct() { $this->hydrator = new ConstructorlessHydrator(); $this->connection = Connection::getConnection(); $this->cache = new EntityCache(); }
public function __construct($ast, $ctx = null, Connection $connection = null) { $this->ast = $ast; $this->ctx = $ctx; $this->connection = $connection ?? Connection::getConnection(); }