PHP Класс Cake\ElasticSearch\Marshaller

Useful when converting request data into documents.
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$type Type Type instance this marshaller is for.

Открытые методы

Метод Описание
__construct ( Type $type ) Constructor
many ( array $data, array $options = [] ) : array Hydrate a collection of entities.
merge ( Cake\Datasource\EntityInterface $entity, array $data, array $options = [] ) : Cake\Datasource\EntityInterface Merges $data into $document.
mergeMany ( array $entities, array $data, array $options = [] ) : array Update a collection of entities.
one ( array $data, array $options = [] ) : Cake\ElasticSearch\Document; Hydrate a single document.

Защищенные методы

Метод Описание
_prepareDataAndOptions ( array $data, array $options ) : array Returns data and options prepared to validate and marshall.
_validate ( array $data, array $options, boolean $isNew ) : array Returns the validation errors for a data set based on the passed options
mergeNested ( Embedded $embed, Document | array $existing, array $data ) : array | Document Merge an embedded document.
newNested ( Embedded $embed, array $data ) : array | Document Marshal an embedded document.

Описание методов

__construct() публичный Метод

Constructor
public __construct ( Type $type )
$type Type The type instance this marshaller is for.

_prepareDataAndOptions() защищенный Метод

Returns data and options prepared to validate and marshall.
protected _prepareDataAndOptions ( array $data, array $options ) : array
$data array The data to prepare.
$options array The options passed to this marshaller.
Результат array An array containing prepared data and options.

_validate() защищенный Метод

Returns the validation errors for a data set based on the passed options
protected _validate ( array $data, array $options, boolean $isNew ) : array
$data array The data to validate.
$options array The options passed to this marshaller.
$isNew boolean Whether it is a new entity or one to be updated.
Результат array The list of validation errors.

many() публичный Метод

### Options: * fieldList: A whitelist of fields to be assigned to the entity. If not present, the accessible fields list in the entity will be used. * accessibleFields: A list of fields to allow or deny in entity accessible fields.
public many ( array $data, array $options = [] ) : array
$data array A list of entity data you want converted into objects.
$options array Options
Результат array An array of hydrated entities

merge() публичный Метод

### Options: * fieldList: A whitelist of fields to be assigned to the entity. If not present the accessible fields list in the entity will be used. * associated: A list of embedded documents you want to marshal.
public merge ( Cake\Datasource\EntityInterface $entity, array $data, array $options = [] ) : Cake\Datasource\EntityInterface
$entity Cake\Datasource\EntityInterface the entity that will get the data merged in
$data array key value list of fields to be merged into the entity
$options array List of options.
Результат Cake\Datasource\EntityInterface

mergeMany() публичный Метод

Merges each of the elements from $data into each of the entities in $entities. Records in $data are matched against the entities using the id field. Entries in $entities that cannot be matched to any record in $data will be discarded. Records in $data that could not be matched will be marshalled as a new entity. ### Options: * fieldList: A whitelist of fields to be assigned to the entity. If not present, the accessible fields list in the entity will be used.
public mergeMany ( array $entities, array $data, array $options = [] ) : array
$entities array An array of Elasticsearch entities
$data array A list of entity data you want converted into objects.
$options array Options
Результат array An array of merged entities

mergeNested() защищенный Метод

Merge an embedded document.
protected mergeNested ( Embedded $embed, Document | array $existing, array $data ) : array | Document
$embed Cake\ElasticSearch\Association\Embedded The embed definition.
$existing Document | array The existing entity or entities.
$data array The data to marshal
Результат array | Document Either a document or an array of documents.

newNested() защищенный Метод

Marshal an embedded document.
protected newNested ( Embedded $embed, array $data ) : array | Document
$embed Cake\ElasticSearch\Association\Embedded The embed definition.
$data array The data to marshal
Результат array | Document Either a document or an array of documents.

one() публичный Метод

### Options: * fieldList: A whitelist of fields to be assigned to the entity. If not present, the accessible fields list in the entity will be used. * accessibleFields: A list of fields to allow or deny in entity accessible fields. * associated: A list of embedded documents you want to marshal.
public one ( array $data, array $options = [] ) : Cake\ElasticSearch\Document;
$data array The data to hydrate.
$options array List of options
Результат Cake\ElasticSearch\Document;

Описание свойств

$type защищенное свойство

Type instance this marshaller is for.
protected Type,Cake\ElasticSearch $type
Результат Type