PHP Class Webiny\Component\Entity\EntityDataExtractor

Inheritance: use trait Webiny\Component\StdLib\StdLibTrait
Afficher le fichier Open project: webiny/framework Class Usage Examples

Protected Properties

Свойство Type Description
$cache
$currentLevel
$entity AbstractEntity
$nestedLevel

Méthodes publiques

Méthode Description
__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.

Private Methods

Méthode Description
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

Method Details

__construct() public méthode

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

extractData() public méthode

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'
Résultat array

Property Details

$cache protected_oe static_oe property

protected static $cache

$currentLevel protected_oe static_oe property

protected static $currentLevel

$entity protected_oe property

protected AbstractEntity,Webiny\Component\Entity $entity
Résultat AbstractEntity

$nestedLevel protected_oe property

protected $nestedLevel