PHP Класс Webiny\Component\Entity\EntityDataExtractor

Наследование: use trait Webiny\Component\StdLib\StdLibTrait
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$cache
$currentLevel
$entity AbstractEntity
$nestedLevel

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

Метод Описание
__construct ( AbstractEntity $entity ) Maximum depth is 10 which is hard to achieve
extractData ( array $attributes = [] ) : array Extract AbstractEntity data to array using specified list of attributes.

Приватные методы

Метод Описание
buildEntityFields ( string | array $fields ) : array Parse fields string and build nested fields structure.
If array is given, will just return that array.
buildFields ( ArrayObject &$parsedFields, StringObject $key ) Parse attribute key recursively
buildNestedKeys ( $fields )
getDefaultAttributes ( ) : string Get default list of entity attributes.
Only simple and Many2One attributes are considered to be default attributes.
getSubAttributesFromArray ( $subAttributes, $array )
parseGroupedNestedFields ( StringObject $string ) : StringObject Check if there are grouped nested keys (by using '[' and ']' and converts that string into a plain version - a string that only contains comma-separated full paths of each field

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

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

Maximum depth is 10 which is hard to achieve
public __construct ( AbstractEntity $entity )
$entity AbstractEntity

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

If no attributes are specified, only simple and Many2One attributes will be extracted. If you need to get One2Many and Many2Many attributes, you need to explicitly specify a list of attributes.
public extractData ( array $attributes = [] ) : array
$attributes array Ex: 'title,author.name,comments.id,comments.text'
Результат array

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

$cache защищенное статическое свойство

protected static $cache

$currentLevel защищенное статическое свойство

protected static $currentLevel

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

protected AbstractEntity,Webiny\Component\Entity $entity
Результат AbstractEntity

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

protected $nestedLevel