$types Associative array containing the types to be used for casting. * @return \Cake\Database\Query\SelectQuery */ public function select( ExpressionInterface|Closure|array|string|float|int $fields = [], array|string $table = [], array $types = [], ): SelectQuery { $query = new SelectQuery($this->connection); $query ->select($fields) ->from($table) ->setDefaultTypes($types); return $query; } /** * Create a new InsertQuery instance. * * @param string|null $table The table to insert rows into. * @param array $values Associative array of column => value to be inserted. * @param array $types Associative array containing the types to be used for casting. * @return \Cake\Database\Query\InsertQuery */ public function insert(?string $table = null, array $values = [], array $types = []): InsertQuery { $query = new InsertQuery($this->connection); if ($table) { $query->into($table); } if ($values) { $columns = array_keys($values); $query ->insert($columns, $types) ->values($values); } return $query; } /** * Create a new UpdateQuery instance. * * @param \Cake\Database\ExpressionInterface|string|null $table The table to update rows of. * @param array $values Values to be updated. * @param array $conditions Conditions to be set for the update statement. * @param array $types Associative array containing the types to be used for casting. * @return \Cake\Database\Query\UpdateQuery */ public function update( ExpressionInterface|string|null $table = null, array $values = [], array $conditions = [], array $types = [], ): UpdateQuery { $query = new UpdateQuery($this->connection); if ($table) { $query->update($table); } if ($values) { $query->set($values, $types); } if ($conditions) { $query->where($conditions, $types); } return $query; } /** * Create a new DeleteQuery instance. * * @param string|null $table The table to delete rows from. * @param array $conditions Conditions to be set for the delete statement. * @param array $types Associative array containing the types to be used for casting. * @return \Cake\Database\Query\DeleteQuery */ public function delete(?string $table = null, array $conditions = [], array $types = []): DeleteQuery { $query = (new DeleteQuery($this->connection)) ->delete($table); if ($conditions) { $query->where($conditions, $types); } return $query; } }