Items is considered as relation

@param  string                 $daddyName
@param  array                  $items
@param  MetadataDataObjectJson $metadata
@return MetadataDataObjectJson
545352
private function hydrateItems(
        $daddyName,
        array $items,
        MetadataDataObjectJson $metadata,
        MetaDataCollection $mainCollection
    ) {
        $mergeArray = true;

        if ($mergeArray === true && $this->itemsAreAllOfType($items, array('object')) === true) {
            $metadata->appendRelation(
                $this->hydrateMetaDataRelationColumn(
                    $daddyName,
                    $this->mergeItems($items),
                    $metadata,
                    $mainCollection
                )
            );
        } else {
            $specialProperties = array();

            foreach ($items as $propName => $item) {
                // Relation of relation
                if (in_array($item->getType(), array('object', 'array')) === false) {
                    $specialProperties[$propName] = $item;
                    continue;
                }

                $metadata->appendRelation(
                    $this->hydrateMetaDataRelationColumn($daddyName, $item->getProperties(), $metadata, $mainCollection)
                );
            }
        }

        return $metadata;
    }
76127
public static function collect($items, $key)
    {
        $array = array();

        foreach ($items as $v) {
            if (is_array($key)) {
                foreach ($key as $index => $k) {
                    if (!isset($array[$k])) {
                        $array[$k] = array();
                    }
                    $array[$k][] = self::getValue($v, $k);
                }
            } else {
                $array[] = self::getValue($v, $key);
            }
        }

        return $array;
    }
916327
public function getProductsToDisplay($items, $mode, &$productsToDisplayCounter, $limit, $maxPerChild)
    {
        $productsToDisplay = [];

        foreach ($items as $item) {
            //parent product
            $productModel = $item->getProduct();
            //check for product exists
            if ($productModel->getId()) {
                //get single product for current mode
                $recommendedProductIds = $this->getRecommendedProduct($productModel, $mode);
                $recommendedProducts = $this->catalog->getProductCollectionFromIds($recommendedProductIds);

                $this->addRecommendedProducts(
                    $productsToDisplayCounter,
                    $limit,
                    $maxPerChild,
                    $recommendedProducts,
                    $productsToDisplay
                );
            }
            //have reached the limit don't loop for more
            if ($productsToDisplayCounter == $limit) {
                break;
            }
        }

        return $productsToDisplay;
    }
64893
private function parseArrayToCatalogFieldEntities(array $items)
    {
        $entities = [];
        foreach ($items as $elementType => $catalogItems) {
            $entities = array_merge($entities, $this->parseArrayToFieldEntities($catalogItems, $elementType));
        }
        return $entities;
    }
482767
public function transformCollection($items, $includes = [], TransformerContract $transformer = null, $meta = [])
    {
        $this->fractal_manager->parseIncludes($includes);
        $transformer = is_null($transformer) ? $this->getTransformer() : $transformer;
        $resource = new Collection($items, $transformer, $this->getModelName());

        $resource->setMeta($meta);
        if ($items instanceof LengthAwarePaginator) {
            $resource->setPaginator(new IlluminatePaginatorAdapter($items));
        }

        return $this->fractal_manager->createData($resource)->toArray();
    }
23992
public function addMetaData($itemKey, $itemValue, $itemGroup = null)
    {
        $this->getMetaData()->addItem(
            new PagSeguroMetaDataItem($itemKey, $itemValue, $itemGroup)
        );
    }
162409
protected function _item($data, $options = [])
    {
        $name = $this->_through;
        $parent = $this->_parent;
        $relThrough = $parent->schema()->relation($name);
        $through = $relThrough->to();
        $id = $this->_parent->id();
        $item = $through::create($id !== null ? $relThrough->match($this->_parent) : [], $options);
        $item->setAt($this->_using, $data, $options);
        return $item;
    }
62027
public function collection($resourceKey, array $data)
    {
        $resources = [];

        foreach ($data as $resource) {
            $resources[] = $this->item($resourceKey, $resource)['data'];
        }

        return ['data' => $resources];
    }
445006
public static function get_metadata(collection $items) : collection {
        // There are several user preferences (shared between different courses).
        // Show/hide toggles preferences.
        $items->add_user_preference('grade_report_showcalculations', 'privacy:metadata:preference:grade_report_showcalculations');
        $items->add_user_preference('grade_report_showeyecons', 'privacy:metadata:preference:grade_report_showeyecons');
        $items->add_user_preference('grade_report_showaverages', 'privacy:metadata:preference:grade_report_showaverages');
        $items->add_user_preference('grade_report_showlocks', 'privacy:metadata:preference:grade_report_showlocks');
        $items->add_user_preference('grade_report_showuserimage', 'privacy:metadata:preference:grade_report_showuserimage');
        $items->add_user_preference('grade_report_showactivityicons', 'privacy:metadata:preference:grade_report_showactivityicons');
        $items->add_user_preference('grade_report_showranges', 'privacy:metadata:preference:grade_report_showranges');
        $items->add_user_preference('grade_report_showanalysisicon', 'privacy:metadata:preference:grade_report_showanalysisicon');
        // Special rows preferences.
        $items->add_user_preference('grade_report_rangesdisplaytype', 'privacy:metadata:preference:grade_report_rangesdisplaytype');
        $items->add_user_preference('grade_report_rangesdecimalpoints', 'privacy:metadata:preference:grade_report_rangesdecimalpoints');
        $items->add_user_preference('grade_report_averagesdisplaytype', 'privacy:metadata:preference:grade_report_averagesdisplaytype');
        $items->add_user_preference('grade_report_averagesdecimalpoints', 'privacy:metadata:preference:grade_report_averagesdecimalpoints');
        $items->add_user_preference('grade_report_meanselection', 'privacy:metadata:preference:grade_report_meanselection');
        $items->add_user_preference('grade_report_shownumberofgrades', 'privacy:metadata:preference:grade_report_shownumberofgrades');
        // General preferences.
        $items->add_user_preference('grade_report_quickgrading', 'privacy:metadata:preference:grade_report_quickgrading');
        $items->add_user_preference('grade_report_showquickfeedback', 'privacy:metadata:preference:grade_report_showquickfeedback');
        $items->add_user_preference('grade_report_studentsperpage', 'privacy:metadata:preference:grade_report_studentsperpage');
        $items->add_user_preference('grade_report_showonlyactiveenrol', 'privacy:metadata:preference:grade_report_showonlyactiveenrol');
        $items->add_user_preference('grade_report_aggregationposition', 'privacy:metadata:preference:grade_report_aggregationposition');
        $items->add_user_preference('grade_report_enableajax', 'privacy:metadata:preference:grade_report_enableajax');

        // There is also one user preference which can be defined on each course.
        $items->add_user_preference('grade_report_grader_collapsed_categories', 'privacy:metadata:preference:grade_report_grader_collapsed_categories');

        return $items;
    }
586575
public function getMetadataFor($entityName, array $parentName = array())
    {
        return $this->hydrateDataObject(
            $this->entityManager->getMetadataFactory()->getMetadataFor($entityName),
            $parentName
        );
    }
270510
public function collection($items, $transformer, $model_name = '', $meta = [])
    {
        $resource = new Collection($items, $transformer, $model_name);

        $resource->setMeta($meta);
        if ($items instanceof LengthAwarePaginator) {
            $resource->setPaginator(new IlluminatePaginatorAdapter($items));
        }

        return $this->manager->createData($resource)->toArray();
    }
1081047
public function findParent(&$items, $item)
    {
        return $items->filter(function ($element) use ($item) {
            return $item->parent_id == $element->id;
        })->first();
    }
923968
public function hasParent($itemName, $parentName)
    {
        $parents = $this->getParents($itemName);
        if (in_array($parentName, $parents)) {
            return true;
        }
        return false;
    }
261416
public function withItem($data, $transformer, $resourceKey = null, $meta = [], array $headers = [])
    {
        $resource = new Item($data, $transformer, $resourceKey);

        foreach ($meta as $metaKey => $metaValue) {
            $resource->setMetaValue($metaKey, $metaValue);
        }

        $rootScope = $this->manager->createData($resource);

        return $this->withArray($rootScope->toArray(), $headers);
    }
898145
public function hasItemChild($itemName,$childName)
	{
		return $this->db->createCommand()
			->select('parent')
			->from($this->itemChildTable)
			->where('parent=:parent AND child=:child', array(
				':parent'=>$itemName,
				':child'=>$childName))
			->queryScalar() !== false;
	}
894089
public function addListField(
        FieldMetadataInterface $itemMetadata,
        string $propertyName,
        string $dbFieldName = null
    ) {
        return $this->addField(new ListField($itemMetadata, $propertyName, $dbFieldName));
    }
326284
public function getDataItem($itemname)
    {
        if (isset($this->data[$itemname])) {
            return $this->data[$itemname];
        }

        return null;
    }