Query
class Query (View source)
Provides convenience for writing custom queries while taking advantage of existing defined schemas.
Methods
Returns a new query with the given parameters.
Returns a new query object without any schemas.
Returns a new query object without any inserted parameters.
Executes the query and returns a PDOStatement instance for the executed query.
Executes the query and returns all result rows as an associated array.
Executes the query and returns models for each row with optionally included relationships.
Executes the query and returns an array of results that have been passed through the given callback.
Returns a generator that fetches the rows one by one for memory efficient processing.
Returns a generator that fetches the models one by one for memory efficient processing.
Returns a generator that returns the result of the callback called for each result row one by one.
Details
at line 32
__construct(Connection $connection, string $sql)
Query constructor.
at line 46
Query
withSchema(Schema $schema, string $alias = '')
Returns a new query object with the given schema.
at line 103
PDOStatement
fetchResult()
Executes the query and returns a PDOStatement instance for the executed query.
at line 133
array
fetchRows()
Executes the query and returns all result rows as an associated array.
at line 144
array
fetchModels(string $alias = '', array $relationships = [])
Executes the query and returns models for each row with optionally included relationships.
at line 154
array
fetchCallback(callable $callback)
Executes the query and returns an array of results that have been passed through the given callback.
at line 163
Generator
generateRows()
Returns a generator that fetches the rows one by one for memory efficient processing.