CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • ConnectionManager
  • ConnectionRegistry
  • FactoryLocator
  • Paginator
  • QueryCacher
  • ResultSetDecorator
  • RulesChecker

Interfaces

  • ConnectionInterface
  • EntityInterface
  • FixtureInterface
  • InvalidPropertyInterface
  • PaginatorInterface
  • QueryInterface
  • RepositoryInterface
  • ResultSetInterface
  • SchemaInterface
  • TableSchemaInterface

Traits

  • EntityTrait
  • ModelAwareTrait
  • QueryTrait
  • RulesAwareTrait

Interface EntityInterface

Describes the methods that any class representing a data storage should comply with.

In 4.x the following methods will officially be added to the interface:

Cake\Datasource\EntityInterface implements ArrayAccess, JsonSerializable
Direct Implementers
  • Cake\ORM\Entity
Namespace: Cake\Datasource
Location: Datasource/EntityInterface.php

Magic properties summary

  • $id public
    mixed
    Alias for commonly used primary key.

Method Summary

  • accessible() public deprecated

    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.

  • clean() public

    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() public deprecated

    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.

  • errors() public deprecated

    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.

  • extract() public

    Returns an array with the requested properties stored in this entity, indexed by property name

  • get() public
    Returns the value of a property by name
  • has() public

    Returns whether this entity contains a property named $property regardless of if it is empty.

  • hiddenProperties() public
    Get/Set the hidden properties on this entity.
  • isNew() public

    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.

  • set() public
    Sets one or multiple properties to the specified value
  • toArray() public
    Returns an array with all the visible properties set in this entity.
  • unsetProperty() public
    Removes a property or list of properties from this entity
  • virtualProperties() public
    Get/Set the virtual properties on this entity.
  • visibleProperties() public
    Get the list of visible properties.

Method Detail

accessible() public deprecated ¶

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.

Deprecated
3.4.0 Use setAccess() and isAccessible() instead.
Parameters
string|array $property
Either a single or list of properties to change its accessibility.
boolean|null $set optional null

true marks the property as accessible, false will mark it as protected.

Returns
Cake\Datasource\EntityInterface|boolean

clean() public ¶

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() public deprecated ¶

dirty( string|null $property = null , boolean|null $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

Deprecated
3.4.0 Use setDirty() and isDirty() instead.
Parameters
string|null $property optional null
the field to set or check status for
boolean|null $isDirty optional null

true means the property was changed, false means it was not changed and null will make the function return current state for that property

Returns
boolean
whether the property was changed or not

errors() public deprecated ¶

errors( string|array|null $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.

Deprecated
3.4.0 Use setErrors() and getErrors() instead.
Parameters
string|array|null $field optional null
The field to get errors for.
string|array|null $errors optional null
The errors to be set for $field
boolean $overwrite optional false
Whether or not to overwrite pre-existing errors for $field
Returns
array|Cake\Datasource\EntityInterface

extract() public ¶

extract( array $properties , boolean $onlyDirty = false )

Returns an array with the requested properties stored in this entity, indexed by property name

Parameters
array $properties
list of properties to be returned
boolean $onlyDirty optional false
Return the requested property only if it is dirty
Returns
array

get() public ¶

get( string $property )

Returns the value of a property by name

Parameters
string $property
the name of the property to retrieve
Returns
mixed

has() public ¶

has( string|array $property )

Returns whether this entity contains a property named $property regardless of if it is empty.

Parameters
string|array $property
The property to check.
Returns
boolean

hiddenProperties() public ¶

hiddenProperties( array|null $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.

Parameters
array|null $properties optional null
Either an array of properties to hide or null to get properties
Returns
array|Cake\Datasource\EntityInterface

isNew() public ¶

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.

Parameters
boolean|null $new optional null
Indicate whether or not this instance has been persisted.
Returns
boolean

If it is known whether the entity was already persisted null otherwise


set() public ¶

set( string|array $property , mixed $value = null , array $options = [] )

Sets one or multiple properties to the specified value

Parameters
string|array $property

the name of property to set or a list of properties with their respective values

mixed $value optional null

The value to set to the property or an array if the first argument is also an array, in which case will be treated as $options

array $options optional []

options to be used for setting the property. Allowed option keys are setter and guard

Returns
Cake\Datasource\EntityInterface

toArray() public ¶

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().

Returns
array

unsetProperty() public ¶

unsetProperty( string|array $property )

Removes a property or list of properties from this entity

Parameters
string|array $property
The property to unset.
Returns
Cake\Datasource\EntityInterface

virtualProperties() public ¶

virtualProperties( array|null $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.

Parameters
array|null $properties optional null
Either an array of properties to treat as virtual or null to get properties
Returns
array|Cake\Datasource\EntityInterface

visibleProperties() public ¶

visibleProperties( )

Get the list of visible properties.

Returns
array
A list of properties that are 'visible' in all representations.

Magic methods summary

extractOriginal() public ¶

extractOriginal( array $properties )

Parameters
array $properties
Returns
array

extractOriginalChanged() public ¶

extractOriginalChanged( array $properties )

Parameters
array $properties
Returns
array

getError() public ¶

getError( $field )

Parameters
$field
Returns
array

getErrors() public ¶

getErrors( )

Returns
array

getHidden() public ¶

getHidden( )

Returns
array

getSource() public ¶

getSource( )

Returns
string

getVirtual() public ¶

getVirtual( )

Returns
array

getVisible() public ¶

getVisible( )

Returns
array

hasErrors() public ¶

hasErrors( $includeNested = )

Parameters
$includeNested optional
Returns
boolean

isAccessible() public ¶

isAccessible( $property )

Parameters
$property
Returns
boolean

isDirty() public ¶

isDirty( $property = )

Parameters
$property optional
Returns
boolean

setError() public ¶

setError( $field , $errors , $overwrite = )

Parameters
$field
$errors
$overwrite optional
Returns
array

setErrors() public ¶

setErrors( array $fields , $overwrite = )

Parameters
array $fields
$overwrite optional
Returns
array

Magic properties detail

$id ¶

public mixed
Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs