View Reference to array
{@inheritdoc}

@param ViewReference $viewReference

@return array
766542
public function reverseTransform($viewReference)
    {
        $array = [];
        foreach ($this->properties as $prop) {
            $methodName = 'get'.ucfirst($prop->getName());
            $array[$prop->getName()] = $viewReference->$methodName();
        }

        return $array;
    }
726678
public function getRef($reference)
    {
        $array = ! isset($reference['$ref']);
        $reference = $array ? $reference : [$reference];
        $database = $this->database;

        $result = array_map(
            function ($ref) use ($database) {
                return MongoDBRef::get($database, $ref);
            },
            $reference
        );

        return $array ? $result : reset($result);
    }
503522
protected function flatReference(array $reference)/*# : array */
    {
        reset($reference);
        foreach ($reference as $key => $value) {
            if (is_object($value)) {
                $reference[$key] = get_class($value);
            } elseif (is_array($value)) {
                $reference[$key] = $this->flatReference($value);
            }
        }
        ksort($reference);
        return $reference;
    }
1283800
public function mapCollectionReferences(array $data): array
    {
        $collectionReferences = [];

        foreach ($data as $dataItem) {
            $collectionReferences[] = CollectionReference::fromArray(
                [
                    'blockId' => (int) $dataItem['block_id'],
                    'blockStatus' => (int) $dataItem['block_status'],
                    'collectionId' => (int) $dataItem['collection_id'],
                    'collectionStatus' => (int) $dataItem['collection_status'],
                    'identifier' => $dataItem['identifier'],
                ]
            );
        }

        return $collectionReferences;
    }
764597
public static function view(string $view, array $data = [])
  {
    $global = Self::$variables::get();
    $data = array_merge($global, $data);

    return Self::$view->view($view, $data);
  }
996606
public function getSection($reference)
    {
        $reference = Section::trimReference($reference);
        $reference = strtolower(Section::normalizeReference($reference));

        foreach ($this->sections as $sectionKey => $section) {
            $potentialMatch = strtolower(Section::normalizeReference($sectionKey));
            if ($reference === $potentialMatch) {
                return $section;
            }
        }

        throw new UnexpectedValueException('Section with a reference of ' . $reference . ' cannot be found!');
    }
986984
public function getDBRef(array $reference)
    {
        if ($this->eventManager->hasListeners(Events::preGetDBRef)) {
            $eventArgs = new EventArgs($this, $reference);
            $this->eventManager->dispatchEvent(Events::preGetDBRef, $eventArgs);
            $reference = $eventArgs->getData();
        }

        $result = $this->doGetDBRef($reference);

        if ($this->eventManager->hasListeners(Events::postGetDBRef)) {
            $eventArgs = new MutableEventArgs($this, $result);
            $this->eventManager->dispatchEvent(Events::postGetDBRef, $eventArgs);
            $result = $eventArgs->getData();
        }

        return $result;
    }
1355441
public function readArray()
    {
        $arrayReference = $this->readInteger();
        if (($arrayReference & 0x01)==0){
            $arrayReference = $arrayReference >> 1;
            if ($arrayReference>=count($this->_referenceObjects)) {
                require_once 'Zend/Amf/Exception.php';
                throw new Zend_Amf_Exception('Unknow array reference: ' . $arrayReference);
            }
            return $this->_referenceObjects[$arrayReference];
        }

        // Create a holder for the array in the reference list
        $data = array();
        $this->_referenceObjects[] =& $data;
        $key = $this->readString();

        // Iterating for string based keys.
        while ($key != '') {
            $data[$key] = $this->readTypeMarker();
            $key = $this->readString();
        }

        $arrayReference = $arrayReference >>1;

        //We have a dense array
        for ($i=0; $i < $arrayReference; $i++) {
            $data[] = $this->readTypeMarker();
        }

        return $data;
    }
536034
protected function getWithRelationFor(array $fields, $view)
    {
        $variables = [];
        $collections = $this->getRelationCollections($fields, $view);

        foreach ($collections as $collection) {
            if (!in_array($collection->name, $variables)) {
                $variables[] = strtolower($collection->name);
            }
        }

        return $this->getWithRelationsStatement($variables);
    }
1276421
private function getCachedDataByReference(Reference $reference)
    {
        return $this->getCachedDataByClassNameAndId($reference->getClassName(), $this->stringify($reference->getId()));
    }
63960
public function buildViewReference(View $view, EntityManager $em = null)
    {
        $viewReferenceBuilder = $this->viewReferenceBuilderChain->getViewReferenceBuilder($view);
        $viewReference = $viewReferenceBuilder->buildReference($view, $em);

        return $viewReference;
    }
1237935
private function getViewModeList()
    {
        $ret = [];
        $entityInfo = entity_get_info('node');

        foreach ($entityInfo['view modes'] as $viewMode => $info) {
            $ret[$viewMode] = $info['label'];
        }

        return $ret;
    }
514656
public static function views()
	{
		$class = get_called_class();

		if ( ! isset(static::$_views_cached[$class]))
		{
			static::$_views_cached[$class] = array();
			if (property_exists($class, '_views'))
			{
				$views = $class::$_views;
				foreach ($views as $k => $v)
				{
					if ( ! isset($v['columns']))
					{
						throw new \InvalidArgumentException('Database view '.$k.' is defined without columns.');
					}
					$v['columns'] = (array) $v['columns'];
					if ( ! isset($v['view']))
					{
						$v['view'] = $k;
					}
					static::$_views_cached[$class][$k] = $v;
				}
			}
		}

		return static::$_views_cached[$class];
	}
805951
public function getViewProviders(View $view)
    {
        foreach (array_keys($this->viewProviders) as $type) {
            if ($view instanceof $type) {
                return $this->viewProviders[$type];
            }
        }
        throw new InvalidArgumentException('view', 'No compatible ViewProvider found for ' . gettype($view));
    }
332484
protected function & getArrayByReference(&$offset)
    {
        $offset = explode(self::SEPARATOR, $offset);

        if (count($offset) > 1) {
            $arr = &$this->getFromArray($this->storage, array_slice($offset, 0, -1), false);
        } else {
            $arr = &$this->storage;
        }

        $offset = array_slice($offset, -1);
        $offset = reset($offset);

        return $arr;
    }
1212402
public function saveReferences(array $viewReferences, $parentId = null, $parentLocale = null, $reset = true)
    {
        // Reset redis if wanted
        if ($reset) {
            $this->manager->reset();
        }

        // Parse the viewReferences
        foreach ($viewReferences as $viewReference) {
            /** @var View $view */
            $view = $viewReference['view'];
            foreach ($view->getReferences() as $locale => $reference) {
                if ($reference !== null) {
                    // save the viewReference
                    $id = $this->saveReference($reference, $parentId, $parentLocale);
                    // if children, save them
                    if (array_key_exists('children', $viewReference) && !empty($children = $viewReference['children'])) {
                        $this->saveReferences($children, $id, $reference->getLocale(), false);
                    }
                }
            }
        }
    }
25143
public static function generateViewReferenceId(View $view, $entity = null)
    {
        $id = $view->getId();
        if ($view instanceof BusinessPage) {
            $id = $view->getTemplate()->getId();
            $entity = $view->getBusinessEntity();
        } elseif (!$view instanceof WebViewInterface) {
            return $view->getId();
        }

        $refId = sprintf('ref_%s', $id);
        if ($entity) {
            $refId .= '_'.$entity->getId();
        }
        if ($view->getCurrentLocale() != '') {
            $refId .= '_'.$view->getCurrentLocale();
        }

        return $refId;
    }