Describes the methods that any class representing a data storage should comply with.
accessible( string|array $property , boolean|null $set null )
Stores whether or not a property value can be changed or set in this entity. The special property *
can also be marked as accessible or protected, meaning that any other property specified before will take its value. For example $entity->accessible('*', true)
means that any property not specified already will be accessible by default.
$property
$set
optional null Cake\Datasource\EntityInterface|boolean
clean( )
Sets the entire entity as clean, which means that it will appear as no properties being modified or added at all. This is an useful call for an initial object hydration
dirty( string $property null , null|boolean $isDirty null )
Sets the dirty status of a single property. If called with no second argument, it will return whether the property was modified or not after the object creation.
When called with no arguments it will return whether or not there are any dirty property in the entity
$property
optional null $isDirty
optional null boolean
errors( string|array $field null , string|array|null $errors null , boolean $overwrite false )
Sets the error messages for a field or a list of fields. When called without the second argument it returns the validation errors for the specified fields. If called with no arguments it returns all the validation error messages stored in this entity.
When used as a setter, this method will return this entity instance for method chaining.
$field
optional null $errors
optional null $overwrite
optional false array|Cake\Datasource\EntityInterface
extract( array $properties , boolean $onlyDirty false )
Returns an array with the requested properties stored in this entity, indexed by property name
$properties
$onlyDirty
optional false array
get( string $property )
Returns the value of a property by name
$property
mixed
has( string $property )
Returns whether this entity contains a property named $property regardless of if it is empty.
$property
boolean
hiddenProperties( null|array $properties null )
Get/Set the hidden properties on this entity.
If the properties argument is null, the currently hidden properties will be returned. Otherwise the hidden properties will be set.
$properties
optional null array|Cake\Datasource\EntityInterface
isNew( boolean|null $new null )
Returns whether or not this entity has already been persisted. This method can return null in the case there is no prior information on the status of this entity.
If called with a boolean, this method will set the status of this instance. Using true
means that the instance has not been persisted in the database, false
that it already is.
$new
optional null boolean
set( string|array $property , mixed $value null , array $options [] )
Sets one or multiple properties to the specified value
$property
$value
optional null $options
optional [] setter
and guard
Cake\Datasource\EntityInterface
toArray( )
Returns an array with all the visible properties set in this entity.
Note hidden properties are not visible, and will not be output by toArray().
array
unsetProperty( string|array $property )
Removes a property or list of properties from this entity
$property
Cake\ORM\
virtualProperties( null|array $properties null )
Get/Set the virtual properties on this entity.
If the properties argument is null, the currently virtual properties will be returned. Otherwise the virtual properties will be set.
$properties
optional null array|Cake\Datasource\EntityInterface
visibleProperties( )
Get the list of visible properties.
array
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/3.1/class-Cake.Datasource.EntityInterface.html