Trait CommonQueryTrait
Trait with common methods used by all ORM query classes.
Property Summary
-
$_repository protected
Cake\ORM\Table
Instance of a repository/table object this query is bound to.
Method Summary
-
addDefaultTypes() public
Hints this object to associate the correct types when casting conditions for the database. This is done by extracting the field types from the schema associated to the passed table object. This prevents the user from repeating themselves when specifying conditions.
-
getRepository() public
Returns the default repository object that will be used by this query, that is, the table that will appear in the from clause.
-
setRepository() public
Set the default Table object that will be used by this query and form the
FROM
clause.
Method Detail
addDefaultTypes() ¶ public
addDefaultTypes(Cake\ORM\Table $table): $this
Hints this object to associate the correct types when casting conditions for the database. This is done by extracting the field types from the schema associated to the passed table object. This prevents the user from repeating themselves when specifying conditions.
This method returns the same query object for chaining.
Parameters
-
Cake\ORM\Table
$table The table to pull types from
Returns
$this
getRepository() ¶ public
getRepository(): Cake\ORM\Table
Returns the default repository object that will be used by this query, that is, the table that will appear in the from clause.
Returns
Cake\ORM\Table
setRepository() ¶ public
setRepository(Cake\Datasource\RepositoryInterface $repository): $this
Set the default Table object that will be used by this query
and form the FROM
clause.
Parameters
-
Cake\Datasource\RepositoryInterface
$repository The default table object to use
Returns
$this
Property Detail
$_repository ¶ protected
Instance of a repository/table object this query is bound to.
Type
Cake\ORM\Table