Property | Type | Description | |
---|---|---|---|
$_alias | string | Human name giving to this particular instance. Multiple objects representing the same database table can exist by using different aliases. | |
$_associations | Cake\ORM\AssociationCollection | The associations container for this Table. | |
$_behaviors | Cake\ORM\BehaviorRegistry | BehaviorRegistry for this table | |
$_connection | Cake\Datasource\ConnectionInterface | Connection instance | |
$_displayField | string | The name of the field that represents a human readable representation of a row | |
$_entityClass | string | The name of the class that represent a single row for this table | |
$_primaryKey | string | array | The name of the field that represents the primary key in the table | |
$_registryAlias | string | Registry key used to create this table object | |
$_schema | Cake\Database\Schema\Table | The schema object containing a description of this table fields | |
$_table | string | Name of the table as it can be found in the database |
Method | Description | |
---|---|---|
__call ( string $method, array $args ) : mixed | Handles behavior delegation + dynamic finders. | |
__construct ( array $config = [] ) | Initializes a new instance | |
__debugInfo ( ) : array | Returns an array that can be used to describe the internal state of this object. | |
__get ( string $property ) : Cake\ORM\Association | Returns the association named after the passed value if exists, otherwise throws an exception. | |
__isset ( string $property ) : boolean | Returns whether an association named after the passed value exists for this table. | |
addAssociations ( array $params ) : void | Setup multiple associations. | |
addBehavior ( string $name, array $options = [] ) : void | Add a behavior. | |
alias ( $alias = null ) | {@inheritDoc} | |
aliasField ( string $field ) : string | Alias a field with the table's current alias. | |
association ( string $name ) : Cake\ORM\Association | null | Returns an association object configured for the specified alias if any | |
associations ( ) : Cake\ORM\AssociationCollection | Get the associations collection for this table. | |
behaviors ( ) : Cake\ORM\BehaviorRegistry | Returns the behavior registry for this table. | |
belongsTo ( string $associated, array $options = [] ) : Cake\ORM\Association\BelongsTo | Creates a new BelongsTo association between this table and a target table. A "belongs to" association is a N-1 relationship where this table is the N side, and where there is a single associated record in the target table for each one in this table. | |
belongsToMany ( string $associated, array $options = [] ) : |
Creates a new BelongsToMany association between this table and a target table. A "belongs to many" association is a M-N relationship. | |
buildRules ( Cake\ORM\RulesChecker $rules ) : Cake\ORM\RulesChecker | {@inheritDoc} | |
callFinder ( string $type, |
Calls a finder method directly and applies it to the passed query, if no query is passed a new one will be created and returned | |
connection ( Cake\Datasource\ConnectionInterface $conn = null ) : Cake\Datasource\ConnectionInterface | Returns the connection instance or sets a new one | |
defaultConnectionName ( ) : string | Get the default connection name. | |
delete ( Cake\Datasource\EntityInterface $entity, $options = [] ) | {@inheritDoc} | |
deleteAll ( $conditions ) | {@inheritDoc} | |
displayField ( string | null $key = null ) : string | Returns the display field or sets a new one | |
entityClass ( string | null $name = null ) : string | Returns the class used to hydrate rows for this table or sets a new one | |
exists ( $conditions ) | {@inheritDoc} | |
find ( $type = 'all', $options = [] ) : |
{@inheritDoc} | |
findAll ( |
Returns the query as passed. | |
findList ( |
Sets up a query object so results appear as an indexed array, useful for any place where you would want a list such as for populating input select boxes. | |
findOrCreate ( array | |
Finds an existing record or creates a new one. | |
findThreaded ( |
Results for this finder will be a nested array, and is appropriate if you want to use the parent_id field of your model data to build nested results. | |
get ( $primaryKey, $options = [] ) | {@inheritDoc} | |
getSaveOptionsBuilder ( array $options = [] ) : Cake\ORM\SaveOptionsBuilder | Gets a SaveOptionsBuilder instance. | |
hasBehavior ( string $name ) : boolean | Check if a behavior with the given alias has been loaded. | |
hasField ( string $field ) : boolean | Test to see if a Table has a specific field/column. | |
hasFinder ( string $type ) : boolean | Returns true if the finder exists for the table | |
hasMany ( string $associated, array $options = [] ) : Cake\ORM\Association\HasMany | Creates a new HasMany association between this table and a target table. A "has many" association is a 1-N relationship. | |
hasOne ( string $associated, array $options = [] ) : Cake\ORM\Association\HasOne | Creates a new HasOne association between this table and a target table. A "has one" association is a 1-1 relationship. | |
implementedEvents ( ) : array | Get the Model callbacks this table is interested in. | |
initialize ( array $config ) : void | Initialize a table instance. Called after the constructor. | |
loadInto ( Cake\Datasource\EntityInterface | array $entities, array $contain ) : Cake\Datasource\EntityInterface | array | Loads the specified associations in the passed entity or list of entities by executing extra queries in the database and merging the results in the appropriate properties. | |
marshaller ( ) : Cake\ORM\Marshaller | Get the object used to marshal/convert array data into objects. | |
newEntities ( array $data, array $options = [] ) | {@inheritDoc} | |
newEntity ( $data = null, array $options = [] ) | {@inheritDoc} | |
patchEntities ( $entities, array $data, array $options = [] ) | {@inheritDoc} | |
patchEntity ( Cake\Datasource\EntityInterface $entity, array $data, array $options = [] ) | {@inheritDoc} | |
primaryKey ( string | array | null $key = null ) : string | array | Returns the primary key field name or sets a new one | |
query ( ) | {@inheritDoc} | |
registryAlias ( string | null $registryAlias = null ) : string | Returns the table registry key used to create this table instance | |
removeBehavior ( string $name ) : void | Removes a behavior from this table's behavior registry. | |
save ( Cake\Datasource\EntityInterface $entity, $options = [] ) | {@inheritDoc} | |
saveMany ( array | Cake\ORM\ResultSet $entities, array | ArrayAccess $options = [] ) : boolean | array | Cake\ORM\ResultSet | Persists multiple entities of a table. | |
schema ( array | Cake\Database\Schema\Table | null $schema = null ) : Cake\Database\Schema\Table | Returns the schema table object describing this table's properties. | |
table ( string | null $table = null ) : string | Returns the database table name or sets a new one | |
updateAll ( $fields, $conditions ) | {@inheritDoc} | |
validateUnique ( mixed $value, array $options, array $context = null ) : boolean | Validator method used to check the uniqueness of a value for a column. |
Method | Description | |
---|---|---|
_dynamicFinder ( string $method, array $args ) : mixed | Provides the dynamic findBy and findByAll methods. | |
_getFindOrCreateQuery ( array | |
Gets the query object for findOrCreate(). | |
_initializeSchema ( Cake\Database\Schema\Table $table ) : Cake\Database\Schema\Table | Override this function in order to alter the schema used by this table. | |
_insert ( Cake\Datasource\EntityInterface $entity, array $data ) : Cake\Datasource\EntityInterface | boolean | Auxiliary function to handle the insert of an entity's data in the table | |
_newId ( array $primary ) : mixed | Generate a primary key value for a new record. | |
_onSaveSuccess ( Cake\Datasource\EntityInterface $entity, ArrayObject $options ) : boolean | Handles the saving of children associations and executing the afterSave logic once the entity for this table has been saved successfully. | |
_processDelete ( Cake\Datasource\EntityInterface $entity, ArrayObject $options ) : boolean | Perform the delete operation. | |
_processFindOrCreate ( array | callable $search, callable $callback = null, array $options = [] ) : Cake\Datasource\EntityInterface | Performs the actual find and/or create of an entity based on the passed options. | |
_processSave ( Cake\Datasource\EntityInterface $entity, ArrayObject $options ) : Cake\Datasource\EntityInterface | boolean | Performs the actual saving of an entity based on the passed options. | |
_setFieldMatchers ( array $options, array $keys ) : array | Out of an options array, check if the keys described in $keys are arrays and change the values for closures that will concatenate the each of the properties in the value array when passed a row. | |
_update ( Cake\Datasource\EntityInterface $entity, array $data ) : Cake\Datasource\EntityInterface | boolean | Auxiliary function to handle the update of an entity's data in the table |
public __construct ( array $config = [] ) | ||
$config | array | List of options for this table |
public __debugInfo ( ) : array | ||
return | array |
protected _getFindOrCreateQuery ( array | |
||
$search | array | |
The criteria to find existing records by. |
return |
protected _initializeSchema ( Cake\Database\Schema\Table $table ) : Cake\Database\Schema\Table | ||
$table | Cake\Database\Schema\Table | The table definition fetched from database. |
return | Cake\Database\Schema\Table | the altered schema |
protected _insert ( Cake\Datasource\EntityInterface $entity, array $data ) : Cake\Datasource\EntityInterface | boolean | ||
$entity | Cake\Datasource\EntityInterface | the subject entity from were $data was extracted |
$data | array | The actual data that needs to be saved |
return | Cake\Datasource\EntityInterface | boolean |
protected _onSaveSuccess ( Cake\Datasource\EntityInterface $entity, ArrayObject $options ) : boolean | ||
$entity | Cake\Datasource\EntityInterface | the entity to be saved |
$options | ArrayObject | the options to use for the save operation |
return | boolean | True on success |
protected _processDelete ( Cake\Datasource\EntityInterface $entity, ArrayObject $options ) : boolean | ||
$entity | Cake\Datasource\EntityInterface | The entity to delete. |
$options | ArrayObject | The options for the delete. |
return | boolean | success |
protected _processFindOrCreate ( array | callable $search, callable $callback = null, array $options = [] ) : Cake\Datasource\EntityInterface | ||
$search | array | callable | The criteria to find an existing record by, or a callable tha will customize the find query. |
$callback | callable | A callback that will be invoked for newly created entities. This callback will be called *before* the entity is persisted. |
$options | array | The options to use when saving. |
return | Cake\Datasource\EntityInterface | An entity. |
protected _processSave ( Cake\Datasource\EntityInterface $entity, ArrayObject $options ) : Cake\Datasource\EntityInterface | boolean | ||
$entity | Cake\Datasource\EntityInterface | the entity to be saved |
$options | ArrayObject | the options to use for the save operation |
return | Cake\Datasource\EntityInterface | boolean |
protected _update ( Cake\Datasource\EntityInterface $entity, array $data ) : Cake\Datasource\EntityInterface | boolean | ||
$entity | Cake\Datasource\EntityInterface | the subject entity from were $data was extracted |
$data | array | The actual data that needs to be saved |
return | Cake\Datasource\EntityInterface | boolean |
public addAssociations ( array $params ) : void | ||
$params | array | Set of associations to bind (indexed by association type) |
return | void |
public aliasField ( string $field ) : string | ||
$field | string | The field to alias. |
return | string | The field prefixed with the table alias. |
public association ( string $name ) : Cake\ORM\Association | null | ||
$name | string | the alias used for the association. |
return | Cake\ORM\Association | null | Either the association or null. |
public associations ( ) : Cake\ORM\AssociationCollection | ||
return | Cake\ORM\AssociationCollection | The collection of association objects. |
public behaviors ( ) : Cake\ORM\BehaviorRegistry | ||
return | Cake\ORM\BehaviorRegistry | The BehaviorRegistry instance. |
public belongsTo ( string $associated, array $options = [] ) : Cake\ORM\Association\BelongsTo | ||
$associated | string | the alias for the target table. This is used to uniquely identify the association |
$options | array | list of options to configure the association definition |
return | Cake\ORM\Association\BelongsTo |
public belongsToMany ( string $associated, array $options = [] ) : |
||
$associated | string | the alias for the target table. This is used to uniquely identify the association |
$options | array | list of options to configure the association definition |
return |
public buildRules ( Cake\ORM\RulesChecker $rules ) : Cake\ORM\RulesChecker | ||
$rules | Cake\ORM\RulesChecker | The rules object to be modified. |
return | Cake\ORM\RulesChecker |
public callFinder ( string $type, |
||
$type | string | name of the finder to be called |
$query | The query object to apply the finder options to | |
$options | array | List of options to pass to the finder |
return |
public connection ( Cake\Datasource\ConnectionInterface $conn = null ) : Cake\Datasource\ConnectionInterface | ||
$conn | Cake\Datasource\ConnectionInterface | The new connection instance |
return | Cake\Datasource\ConnectionInterface |
public static defaultConnectionName ( ) : string | ||
return | string |
public delete ( Cake\Datasource\EntityInterface $entity, $options = [] ) | ||
$entity | Cake\Datasource\EntityInterface |
public find ( $type = 'all', $options = [] ) : |
||
return | The query builder |
public findOrCreate ( array | |
||
$search | array | |
The criteria to find existing records by. Note that when you pass a query object you'll have to use the 2nd arg of the method to modify the entity data before saving. |
$callback | callable | A callback that will be invoked for newly created entities. This callback will be called *before* the entity is persisted. |
$options | array | The options to use when saving. |
return | Cake\Datasource\EntityInterface | An entity. |
public findThreaded ( |
||
$query | The query to find with | |
$options | array | The options to find with |
return | The query builder |
public get ( $primaryKey, $options = [] ) |
public getSaveOptionsBuilder ( array $options = [] ) : Cake\ORM\SaveOptionsBuilder | ||
$options | array | Options to parse by the builder. |
return | Cake\ORM\SaveOptionsBuilder |
public hasBehavior ( string $name ) : boolean | ||
$name | string | The behavior alias to check. |
return | boolean | Whether or not the behavior exists. |
public implementedEvents ( ) : array | ||
return | array |
public initialize ( array $config ) : void | ||
$config | array | Configuration options passed to the constructor |
return | void |
public loadInto ( Cake\Datasource\EntityInterface | array $entities, array $contain ) : Cake\Datasource\EntityInterface | array | ||
$entities | Cake\Datasource\EntityInterface | array | a single entity or list of entities |
$contain | array | A `contain()` compatible array. |
return | Cake\Datasource\EntityInterface | array |
public marshaller ( ) : Cake\ORM\Marshaller | ||
return | Cake\ORM\Marshaller |
public newEntities ( array $data, array $options = [] ) | ||
$data | array | |
$options | array |
public patchEntities ( $entities, array $data, array $options = [] ) | ||
$data | array | |
$options | array |
public patchEntity ( Cake\Datasource\EntityInterface $entity, array $data, array $options = [] ) | ||
$entity | Cake\Datasource\EntityInterface | |
$data | array | |
$options | array |
public removeBehavior ( string $name ) : void | ||
$name | string | The alias that the behavior was added with. |
return | void |
public save ( Cake\Datasource\EntityInterface $entity, $options = [] ) | ||
$entity | Cake\Datasource\EntityInterface |
public saveMany ( array | Cake\ORM\ResultSet $entities, array | ArrayAccess $options = [] ) : boolean | array | Cake\ORM\ResultSet | ||
$entities | array | Cake\ORM\ResultSet | Entities to save. |
$options | array | ArrayAccess | Options used when calling Table::save() for each entity. |
return | boolean | array | Cake\ORM\ResultSet | False on failure, entities list on success. |
public validateUnique ( mixed $value, array $options, array $context = null ) : boolean | ||
$value | mixed | The value of column to be checked for uniqueness |
$options | array | The options array, optionally containing the 'scope' key. May also be the validation context if there are no options. |
$context | array | Either the validation context or null. |
return | boolean | true if the value is unique |
protected string $_alias | ||
return | string |
protected AssociationCollection,Cake\ORM $_associations | ||
return | Cake\ORM\AssociationCollection |
protected BehaviorRegistry,Cake\ORM $_behaviors | ||
return | Cake\ORM\BehaviorRegistry |
protected ConnectionInterface,Cake\Datasource $_connection | ||
return | Cake\Datasource\ConnectionInterface |
protected string $_displayField | ||
return | string |
protected string $_entityClass | ||
return | string |
protected string $_registryAlias | ||
return | string |
protected Table,Cake\Database\Schema $_schema | ||
return | Cake\Database\Schema\Table |
protected string $_table | ||
return | string |