PHP Класс Mongolid\DataMapper\EntityAssembler

This class is meant to do the opposite of the SchemaMapper.
См. также: http://martinfowler.com/eaaCatalog/dataTransferObject.html
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
assemble ( array | object $document, Schema $schema ) : mixed Builds an object from the provided data.

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

Метод Описание
assembleDocumentsRecursively ( mixed $value, string $schemaClass ) : mixed Assembly multiple documents for the given $schemaClass recursively.
morphingTime ( mixed $entity ) : mixed Returns the return of polymorph method of the given entity if available.
prepareOriginalAttributes ( mixed $entity ) : mixed Stores original attributes from Entity if needed.

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

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

Builds an object from the provided data.
public assemble ( array | object $document, Schema $schema ) : mixed
$document array | object The attributes that will be used to compose the entity.
$schema Mongolid\Schema\Schema Schema that will be used to map each field.
Результат mixed

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

Assembly multiple documents for the given $schemaClass recursively.
protected assembleDocumentsRecursively ( mixed $value, string $schemaClass ) : mixed
$value mixed A value of an embeded field containing entity data to be assembled.
$schemaClass string The schemaClass to be used when assembling the entities within $value.
Результат mixed

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

Returns the return of polymorph method of the given entity if available.
См. также: Mongolid\Model\PolymorphableInterface::polymorph
См. также: https://i.ytimg.com/vi/TFGN9kAjdis/maxresdefault.jpg
protected morphingTime ( mixed $entity ) : mixed
$entity mixed The entity that may or may not have a polymorph method.
Результат mixed The result of $entity->polymorph or the $entity itself.

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

Stores original attributes from Entity if needed.
protected prepareOriginalAttributes ( mixed $entity ) : mixed
$entity mixed The entity that may have the attributes stored.
Результат mixed The entity with original attributes.