CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C Elastic Search 2.x API

  • Project:
    • Elastic Search
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 2.x
      • 4.x
      • 3.x
      • 2.x

Namespaces

  • Cake\ElasticSearch
    • Association
    • Datasource
    • Rule
    • TestSuite
    • View

Class Document

Represents a document stored in a Elastic Search Index

Namespace: Cake\ElasticSearch

Property Summary

  • $_accessible protected
    array

    Map of properties in this entity that can be safely assigned, each property name points to a boolean indicating its status. An empty array means no properties are accessible

  • $_accessors protected static
    array

    Holds a cached list of getters/setters per class

  • $_className protected deprecated
    string

    Holds the name of the class for the instance object

  • $_dirty protected
    bool[]

    Holds a list of the properties that were modified or added after this object was originally created.

  • $_errors protected
    array

    List of errors per field as stored in this object

  • $_hidden protected
    string[]

    List of property names that should not be included in JSON or Array representations of this Entity.

  • $_invalid protected
    array

    List of invalid fields and their data for errors upon validation/patching

  • $_new protected
    bool

    Indicates whether or not this entity is yet to be persisted. Entities default to assuming they are new. You can use Table::persisted() to set the new flag on an entity based on records in the database.

  • $_original protected
    array

    Holds all properties that have been changed and their original values for this entity

  • $_properties protected
    array

    Holds all properties and their values for this entity

  • $_registryAlias protected
    string

    The alias of the repository this entity came from

  • $_result protected
    Elastica\Result

    Holds an instance of a Result object that's passed into the constructor from a search query. It can contain extra information about this document concerning the search operation, such as highlights, score and version.

  • $_virtual protected
    string[]

    List of computed or virtual fields that should be included in JSON or array representations of this Entity. If a field is present in both _hidden and _virtual the field will not be in the array/json versions of the entity.

  • $id public @property
    mixed

    Alias for commonly used primary key.

Method Summary

  • __construct() public

    Takes either an array or a Result object form a search and constructs a document representing an entity in a elastic search type,

  • __debugInfo() public

    Returns an array that can be used to describe the internal state of this object.

  • __get() public

    Magic getter to access properties that have been set in this entity

  • __isset() public

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

  • __set() public

    Magic setter to add or edit a property in this entity

  • __toString() public

    Returns a string representation of this object in a human readable format.

  • __unset() public

    Removes a property from this entity

  • _accessor() protected static

    Fetch accessor method name Accessor methods (available or not) are cached in $_accessors

  • _nestedErrors() protected

    Auxiliary method for getting errors in nested entities

  • _readError() protected

    Read the error(s) from one or many objects.

  • _readHasErrors() protected

    Reads if there are errors for one or many objects.

  • 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 and any other nested entity.

  • explanation() public

    Returns the explanation array for this document as returned from Elasticsearch.

  • extract() public

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

  • extractOriginal() public

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

  • extractOriginalChanged() public

    Returns an array with only the original properties stored in this entity, indexed by property name.

  • get() public

    Returns the value of a property by name

  • getAccessible() public

    Returns the raw accessible configuration for this entity. The * wildcard refers to all fields.

  • getDirty() public

    Gets the dirty properties.

  • getError() public

    Returns validation errors of a field

  • getErrors() public

    Returns all validation errors.

  • getHidden() public

    Gets the hidden properties.

  • getInvalid() public

    Get a list of invalid fields and their data for errors upon validation/patching

  • getInvalidField() public

    Get a single value of an invalid field. Returns null if not set.

  • getOriginal() public

    Returns the value of an original property by name

  • getOriginalValues() public

    Gets all original values of the entity.

  • getSource() public

    Returns the alias of the repository from which this entity came from.

  • getVirtual() public

    Gets the virtual properties on this entity.

  • getVisible() public

    Gets the list of visible properties.

  • has() public

    Returns whether this entity contains a property named $property that contains a non-null value.

  • hasErrors() public

    Returns whether this entity has errors.

  • hasValue() public

    Checks tha a property has a value.

  • hiddenProperties() public deprecated

    Get/Set the hidden properties on this entity.

  • highlights() public

    Returns the highlights array for document as returned by Elasticsearch for the executed query.

  • invalid() public deprecated

    Sets a field as invalid and not patchable into the entity.

  • isAccessible() public

    Checks if a property is accessible

  • isDirty() public

    Checks if the entity is dirty or if a single property of it is dirty.

  • isEmpty() public

    Checks that a property is empty

  • isNew() public

    Returns whether or not this entity has already been persisted.

  • jsonSerialize() public

    Returns the properties that will be serialized as JSON

  • offsetExists() public

    Implements isset($entity);

  • offsetGet() public

    Implements $entity[$offset];

  • offsetSet() public

    Implements $entity[$offset] = $value;

  • offsetUnset() public

    Implements unset($result[$offset]);

  • set() public

    Sets a single property inside this entity.

  • setAccess() public

    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->setAccess('*', true) means that any property not specified already will be accessible by default.

  • setDirty() public

    Sets the dirty status of a single property.

  • setError() public

    Sets errors for a single field

  • setErrors() public

    Sets error messages to the entity

  • setHidden() public

    Sets hidden properties.

  • setInvalid() public

    Set fields as invalid and not patchable into the entity.

  • setInvalidField() public

    Sets a field as invalid and not patchable into the entity.

  • setNew() public

    Set the status of this entity.

  • setSource() public

    Sets the source alias

  • setVirtual() public

    Sets the virtual properties on this entity.

  • source() public deprecated

    Returns the alias of the repository from which this entity came from.

  • toArray() public

    Returns an array with all the properties that have been set to this entity

  • type() public

    Returns the Elasticsearch type name from which this document came from.

  • unsetProperty() public

    Removes a property or list of properties from this entity

  • version() public

    Returns the version number of this document as returned by Elasticsearch

  • virtualProperties() public deprecated

    Get/Set the virtual properties on this entity.

  • visibleProperties() public deprecated

    Gets the list of visible properties.

Method Detail

__construct() ¶ public

__construct(array|Elastica\Result $data = [], array $options = [])

Takes either an array or a Result object form a search and constructs a document representing an entity in a elastic search type,

Parameters
array|Elastica\Result $data optional

An array or Result object that represents an Elasticsearch document

array $options optional

An array of options to set the state of the document

__debugInfo() ¶ public

__debugInfo(): array

Returns an array that can be used to describe the internal state of this object.

Returns
array

__get() ¶ public

__get(string $property): mixed

Magic getter to access properties that have been set in this entity

Parameters
string $property

Name of the property to access

Returns
mixed

__isset() ¶ public

__isset(string $property): bool

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

Parameters
string $property

The property to check.

Returns
bool
See Also
\Cake\ORM\Entity::has()

__set() ¶ public

__set(string $property, mixed $value): void

Magic setter to add or edit a property in this entity

Parameters
string $property

The name of the property to set

mixed $value

The value to set to the property

Returns
void

__toString() ¶ public

__toString(): string

Returns a string representation of this object in a human readable format.

Returns
string

__unset() ¶ public

__unset(string $property): void

Removes a property from this entity

Parameters
string $property

The property to unset

Returns
void

_accessor() ¶ protected static

_accessor(string $property, string $type): string

Fetch accessor method name Accessor methods (available or not) are cached in $_accessors

Parameters
string $property

the field name to derive getter name from

string $type

the accessor type ('get' or 'set')

Returns
string

_nestedErrors() ¶ protected

_nestedErrors(string $field): array

Auxiliary method for getting errors in nested entities

Parameters
string $field

the field in this entity to check for errors

Returns
array

_readError() ¶ protected

_readError(array|Cake\Datasource\EntityInterface $object, string|null $path = null): array

Read the error(s) from one or many objects.

Parameters
array|Cake\Datasource\EntityInterface $object

The object to read errors from.

string|null $path optional

The field name for errors.

Returns
array

_readHasErrors() ¶ protected

_readHasErrors(mixed $object): bool

Reads if there are errors for one or many objects.

Parameters
mixed $object

The object to read errors from.

Returns
bool

accessible() ¶ public

accessible(string|array $property, bool|null $set = null): $this|bool

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.

You can also call this method with an array of properties, in which case they will each take the accessibility value specified in the second argument.

Example:

$entity->accessible('id', true); // Mark id as not protected
$entity->accessible('author_id', false); // Mark author_id as protected
$entity->accessible(['id', 'user_id'], true); // Mark both properties as accessible
$entity->accessible('*', false); // Mark all properties as protected

When called without the second param it will return whether or not the property can be set.

Example:

$entity->accessible('id'); // Returns whether it can be set or not
Parameters
string|array $property

single or list of properties to change its accessibility

bool|null $set optional

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

Returns
$this|bool

clean() ¶ public

clean(): void

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

Returns
void

dirty() ¶ public

dirty(string|null $property = null, bool|null $isDirty = null): bool

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

Parameters
string|null $property optional

the field to set or check status for

bool|null $isDirty optional

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
bool

errors() ¶ public

errors(string|array|null $field = null, string|array|null $errors = null, bool $overwrite = false): array|$this

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 and any other nested entity.

Example

// Sets the error messages for a single field
$entity->errors('salary', ['must be numeric', 'must be a positive number']);

// Returns the error messages for a single field
$entity->getErrors('salary');

// Returns all error messages indexed by field name
$entity->getErrors();

// Sets the error messages for multiple fields at once
$entity->getErrors(['salary' => ['message'], 'name' => ['another message']);

When used as a setter, this method will return this entity instance for method chaining.

Parameters
string|array|null $field optional

The field to get errors for, or the array of errors to set.

string|array|null $errors optional

The errors to be set for $field

bool $overwrite optional

Whether or not to overwrite pre-existing errors for $field

Returns
array|$this

explanation() ¶ public

explanation(): array

Returns the explanation array for this document as returned from Elasticsearch.

If this is a new document, or the query used to create it did not ask for explanation, this function will return an empty array.

Returns
array

extract() ¶ public

extract(array $properties, bool $onlyDirty = false): array

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

Parameters
array $properties

list of properties to be returned

bool $onlyDirty optional

Return the requested property only if it is dirty

Returns
array

extractOriginal() ¶ public

extractOriginal(string[] $properties): array

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

Properties that are unchanged from their original value will be included in the return of this method.

Parameters
string[] $properties

List of properties to be returned

Returns
array

extractOriginalChanged() ¶ public

extractOriginalChanged(string[] $properties): array

Returns an array with only the original properties stored in this entity, indexed by property name.

This method will only return properties that have been modified since the entity was built. Unchanged properties will be omitted.

Parameters
string[] $properties

List of properties to be returned

Returns
array

get() ¶ public

get(string $property): mixed

Returns the value of a property by name

Parameters
string $property

the name of the property to retrieve

Returns
mixed
Throws
InvalidArgumentException
if an empty property name is passed

getAccessible() ¶ public

getAccessible(): bool[]

Returns the raw accessible configuration for this entity. The * wildcard refers to all fields.

Returns
bool[]

getDirty() ¶ public

getDirty(): string[]

Gets the dirty properties.

Returns
string[]

getError() ¶ public

getError(mixed $field): array

Returns validation errors of a field

Parameters
$field

Field name to get the errors from

Returns
array

getErrors() ¶ public

getErrors(): array

Returns all validation errors.

Returns
array

getHidden() ¶ public

getHidden(): string[]

Gets the hidden properties.

Returns
string[]

getInvalid() ¶ public

getInvalid(): array

Get a list of invalid fields and their data for errors upon validation/patching

Returns
array

getInvalidField() ¶ public

getInvalidField(string $field): mixed|null

Get a single value of an invalid field. Returns null if not set.

Parameters
string $field

The name of the field.

Returns
mixed|null

getOriginal() ¶ public

getOriginal(string $property): mixed

Returns the value of an original property by name

Parameters
string $property

the name of the property for which original value is retrieved.

Returns
mixed
Throws
InvalidArgumentException
if an empty property name is passed.

getOriginalValues() ¶ public

getOriginalValues(): array

Gets all original values of the entity.

Returns
array

getSource() ¶ public

getSource(): string

Returns the alias of the repository from which this entity came from.

Returns
string

getVirtual() ¶ public

getVirtual(): string[]

Gets the virtual properties on this entity.

Returns
string[]

getVisible() ¶ public

getVisible(): string[]

Gets the list of visible properties.

The list of visible properties is all standard properties plus virtual properties minus hidden properties.

Returns
string[]

has() ¶ public

has(string|array $property): bool

Returns whether this entity contains a property named $property that contains a non-null value.

Example:

$entity = new Entity(['id' => 1, 'name' => null]);
$entity->has('id'); // true
$entity->has('name'); // false
$entity->has('last_name'); // false

You can check multiple properties by passing an array:

$entity->has(['name', 'last_name']);

All properties must not be null to get a truthy result.

When checking multiple properties. All properties must not be null in order for true to be returned.

Parameters
string|array $property

The property or properties to check.

Returns
bool

hasErrors() ¶ public

hasErrors(mixed $includeNested = true): bool

Returns whether this entity has errors.

Parameters
$includeNested optional

true will check nested entities for hasErrors()

Returns
bool

hasValue() ¶ public

hasValue(string $property): bool

Checks tha a property has a value.

This method will return true for

  • Non-empty strings
  • Non-empty arrays
  • Any object
  • Integer, even 0
  • Float, even 0.0

and false in all other cases.

Parameters
string $property

The property to check.

Returns
bool

hiddenProperties() ¶ public

hiddenProperties(array|null $properties = null): string[]|$this

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

Either an array of properties to hide or null to get properties

Returns
string[]|$this

highlights() ¶ public

highlights(): array

Returns the highlights array for document as returned by Elasticsearch for the executed query.

If this is a new document, or the query used to create it did not ask for highlights, this function will return an empty array.

Returns
array

invalid() ¶ public

invalid(string|array|null $field = null, mixed|null $value = null, bool $overwrite = false): $this|mixed

Sets a field as invalid and not patchable into the entity.

This is useful for batch operations when one needs to get the original value for an error message after patching. This value could not be patched into the entity and is simply copied into the _invalid property for debugging purposes or to be able to log it away.

Parameters
string|array|null $field optional

The field to get invalid value for, or the value to set.

mixed|null $value optional

The invalid value to be set for $field.

bool $overwrite optional

Whether or not to overwrite pre-existing values for $field.

Returns
$this|mixed

isAccessible() ¶ public

isAccessible(mixed $property): bool

Checks if a property is accessible

Example:

$entity->isAccessible('id'); // Returns whether it can be set or not
Parameters
$property

Property name to check

Returns
bool

isDirty() ¶ public

isDirty(mixed $property = null): bool

Checks if the entity is dirty or if a single property of it is dirty.

Parameters
$property optional

The field to check the status for. Null for the whole entity.

Returns
bool

isEmpty() ¶ public

isEmpty(string $property): bool

Checks that a property is empty

This is not working like the PHP empty() function. The method will return true for:

  • '' (empty string)
  • null
  • []

and false in all other cases.

Parameters
string $property

The property to check.

Returns
bool

isNew() ¶ public

isNew(bool|null $new = null): bool

Returns whether or not this entity has already been persisted.

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
bool|null $new optional

true if it is known this instance was not yet persisted. This will be deprecated in 4.0, use setNew() instead.

Returns
bool

jsonSerialize() ¶ public

jsonSerialize(): array

Returns the properties that will be serialized as JSON

Returns
array

offsetExists() ¶ public

offsetExists(mixed $offset): bool

Implements isset($entity);

Parameters
mixed $offset

The offset to check.

Returns
bool

offsetGet() ¶ public

offsetGet(mixed $offset): mixed

Implements $entity[$offset];

Parameters
mixed $offset

The offset to get.

Returns
mixed

offsetSet() ¶ public

offsetSet(mixed $offset, mixed $value): void

Implements $entity[$offset] = $value;

Parameters
mixed $offset

The offset to set.

mixed $value

The value to set.

Returns
void

offsetUnset() ¶ public

offsetUnset(mixed $offset): void

Implements unset($result[$offset]);

Parameters
mixed $offset

The offset to remove.

Returns
void

set() ¶ public

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

Sets a single property inside this entity.

Example:

$entity->set('name', 'Andrew');

It is also possible to mass-assign multiple properties to this entity with one call by passing a hashed array as properties in the form of property => value pairs

Example:

$entity->set(['name' => 'andrew', 'id' => 1]);
echo $entity->name // prints andrew
echo $entity->id // prints 1

Some times it is handy to bypass setter functions in this entity when assigning properties. You can achieve this by disabling the setter option using the $options parameter:

$entity->set('name', 'Andrew', ['setter' => false]);
$entity->set(['name' => 'Andrew', 'id' => 1], ['setter' => false]);

Mass assignment should be treated carefully when accepting user input, by default entities will guard all fields when properties are assigned in bulk. You can disable the guarding for a single set call with the guard option:

$entity->set(['name' => 'Andrew', 'id' => 1], ['guard' => true]);

You do not need to use the guard option when assigning properties individually:

// No need to use the guard option.
$entity->set('name', 'Andrew');
Parameters
string|array $property

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

mixed $value optional

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
$this
Throws
InvalidArgumentException

setAccess() ¶ public

setAccess(mixed $property, mixed $set): $this

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->setAccess('*', true) means that any property not specified already will be accessible by default.

You can also call this method with an array of properties, in which case they will each take the accessibility value specified in the second argument.

Example:

$entity->setAccess('id', true); // Mark id as not protected
$entity->setAccess('author_id', false); // Mark author_id as protected
$entity->setAccess(['id', 'user_id'], true); // Mark both properties as accessible
$entity->setAccess('*', false); // Mark all properties as protected
Parameters
$property

single or list of properties to change its accessibility

$set

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

Returns
$this

setDirty() ¶ public

setDirty(mixed $property, mixed $isDirty = true): $this

Sets the dirty status of a single property.

Parameters
$property

the field to set or check status for

$isDirty optional

true means the property was changed, false means it was not changed. Defaults to true.

Returns
$this

setError() ¶ public

setError(mixed $field, mixed $errors, mixed $overwrite = false): $this

Sets errors for a single field

Example

// Sets the error messages for a single field
$entity->setError('salary', ['must be numeric', 'must be a positive number']);
Parameters
$field

The field to get errors for, or the array of errors to set.

$errors

The errors to be set for $field

$overwrite optional

Whether or not to overwrite pre-existing errors for $field

Returns
$this

setErrors() ¶ public

setErrors(array $errors, mixed $overwrite = false): $this

Sets error messages to the entity

Example

// Sets the error messages for multiple fields at once
$entity->setErrors(['salary' => ['message'], 'name' => ['another message']]);
Parameters
array $errors

The array of errors to set.

$overwrite optional

Whether or not to overwrite pre-existing errors for $fields

Returns
$this

setHidden() ¶ public

setHidden(string[] $properties, mixed $merge = false): $this

Sets hidden properties.

Parameters
string[] $properties

An array of properties to hide from array exports.

$merge optional

Merge the new properties with the existing. By default false.

Returns
$this

setInvalid() ¶ public

setInvalid(array $fields, bool $overwrite = false): $this

Set fields as invalid and not patchable into the entity.

This is useful for batch operations when one needs to get the original value for an error message after patching. This value could not be patched into the entity and is simply copied into the _invalid property for debugging purposes or to be able to log it away.

Parameters
array $fields

The values to set.

bool $overwrite optional

Whether or not to overwrite pre-existing values for $field.

Returns
$this

setInvalidField() ¶ public

setInvalidField(string $field, mixed $value): $this

Sets a field as invalid and not patchable into the entity.

Parameters
string $field

The value to set.

mixed $value

The invalid value to be set for $field.

Returns
$this

setNew() ¶ public

setNew(mixed $new): $this

Set the status of this entity.

Using true means that the entity has not been persisted in the database, false that it already is.

Parameters
$new

Indicate whether or not this entity has been persisted.

Returns
$this

setSource() ¶ public

setSource(string $alias): $this

Sets the source alias

Parameters
string $alias

the alias of the repository

Returns
$this

setVirtual() ¶ public

setVirtual(string[] $properties, mixed $merge = false): $this

Sets the virtual properties on this entity.

Parameters
string[] $properties

An array of properties to treat as virtual.

$merge optional

Merge the new properties with the existing. By default false.

Returns
$this

source() ¶ public

source(string|null $alias = null): string|$this

Returns the alias of the repository from which this entity came from.

If called with no arguments, it returns the alias of the repository this entity came from if it is known.

Parameters
string|null $alias optional

the alias of the repository

Returns
string|$this

toArray() ¶ public

toArray(): array

Returns an array with all the properties that have been set to this entity

This method will recursively transform entities assigned to properties into arrays as well.

Returns
array

type() ¶ public

type(): string|null

Returns the Elasticsearch type name from which this document came from.

If this is a new document, this function returns null

Returns
string|null

unsetProperty() ¶ public

unsetProperty(string|array $property): $this

Removes a property or list of properties from this entity

Examples:

$entity->unsetProperty('name');
$entity->unsetProperty(['name', 'last_name']);
Parameters
string|array $property

The property to unset.

Returns
$this

version() ¶ public

version(): int

Returns the version number of this document as returned by Elasticsearch

If this is a new document, this function returns 1

Returns
int

virtualProperties() ¶ public

virtualProperties(array|null $properties = null): string[]|$this

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

Either an array of properties to treat as virtual or null to get properties

Returns
string[]|$this

visibleProperties() ¶ public

visibleProperties(): string[]

Gets the list of visible properties.

The list of visible properties is all standard properties plus virtual properties minus hidden properties.

Returns
string[]

Property Detail

$_accessible ¶ protected

Map of properties in this entity that can be safely assigned, each property name points to a boolean indicating its status. An empty array means no properties are accessible

The special property '*' can also be mapped, meaning that any other property not defined in the map will take its value. For example, '\*' => true means that any property not defined in the map will be accessible by default

Type
array

$_accessors ¶ protected static

Holds a cached list of getters/setters per class

Type
array

$_className ¶ protected deprecated

Holds the name of the class for the instance object

Type
string

$_dirty ¶ protected

Holds a list of the properties that were modified or added after this object was originally created.

Type
bool[]

$_errors ¶ protected

List of errors per field as stored in this object

Type
array

$_hidden ¶ protected

List of property names that should not be included in JSON or Array representations of this Entity.

Type
string[]

$_invalid ¶ protected

List of invalid fields and their data for errors upon validation/patching

Type
array

$_new ¶ protected

Indicates whether or not this entity is yet to be persisted. Entities default to assuming they are new. You can use Table::persisted() to set the new flag on an entity based on records in the database.

Type
bool

$_original ¶ protected

Holds all properties that have been changed and their original values for this entity

Type
array

$_properties ¶ protected

Holds all properties and their values for this entity

Type
array

$_registryAlias ¶ protected

The alias of the repository this entity came from

Type
string

$_result ¶ protected

Holds an instance of a Result object that's passed into the constructor from a search query. It can contain extra information about this document concerning the search operation, such as highlights, score and version.

Type
Elastica\Result

$_virtual ¶ protected

List of computed or virtual fields that should be included in JSON or array representations of this Entity. If a field is present in both _hidden and _virtual the field will not be in the array/json versions of the entity.

Type
string[]

$id ¶ public @property

Alias for commonly used primary key.

Type
mixed
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs