Генерация карты сущностей и сохранение ее в кеше

@return array
349110
public function buildAction()
    {
        /** @var Request $request */
        $request = $this->getRequest();
        $managerName = $request->getParam('objectManager', 'doctrine.entitymanager.orm_default');

        if (!$this->getDoctrineObjectManager()->has($managerName)) {
            return [
                ConsoleModel::RESULT => sprintf('Doctrine ObjectManager %s not found', $managerName)
            ];
        }

        $entityMapCache = $this->getEntityMapCache();
        if ($entityMapCache->hasEntityMap($managerName)) {
            $entityMapCache->deleteEntityMap($managerName);
        }
        $entityMapCache->saveEntityMap($managerName);


        $entityMap = $entityMapCache->loadEntityMap($managerName);

        if (is_array($entityMap)) {
            $result = "Entity map:\n";
            foreach ($entityMap as $interfaceName => $className) {
                $result .= sprintf("Interface  name: %s. Class name: %s \n", $interfaceName, $className);
            }
        } else {
            $result = 'Empty entity map';
        }


        return [
            ConsoleModel::RESULT => $result
        ];
    }
593701
public function toArray()
    {
        return [
            'ref'             => $this->sRef,
            'state'           => $this->sState,
            'dated'           => $this->sDated,
            'terms'           => (int) $this->iTerms ?: null,
            'customer_id'     => (int) $this->iCustomerId ?: null,
            'email'           => $this->sEmail,
            'currency'        => $this->sCurrency,
            'additional_text' => $this->sAdditionalText,
            'callback_data'   => $this->mCallbackData,
            'items'           => (array) $this->aItems,
        ];
    }
188659
public function toArray(): array
    {
        return array_filter([
            'name' => $this->name,
            'field' => 'uuid.type' === $this->field
                ? null
                : $this->field,
            'application_type' => Filter::AT_LEAST_ONE === $this->applicationType
                ? null
                : $this->applicationType,
            'filter_type' => Filter::TYPE_FIELD === $this->filterType
                ? null
                : $this->filterType,
            'subgroup' => empty($this->subgroup)
                ? null
                : $this->subgroup,
            'sort' => self::SORT_BY_COUNT_DESC === $this->sort
                ? null
                : $this->sort,
            'limit' => self::NO_LIMIT === $this->limit
                ? null
                : $this->limit,
        ], function ($element) {
            return
            !(
                is_null($element) ||
                (is_array($element) && empty($element))
            );
        });
    }
487787
private function gedcomHead(): array
    {
        $title   = '';
        $version = '';
        $source  = '';

        $head = GedcomRecord::getInstance('HEAD', $this->tree);

        if ($head instanceof GedcomRecord) {
            $sour = $head->facts(['SOUR'])->first();

            if ($sour instanceof Fact) {
                $source  = $sour->value();
                $title   = $sour->attribute('NAME');
                $version = $sour->attribute('VERS');
            }
        }

        return [
            $title,
            $version,
            $source,
        ];
    }
191084
public function toArray()
    {
        return [
            'userAgent'          => $this->userAgent,
            'browser'            => $this->browser,
            'version'            => $this->version,
            'majorVersion'       => $this->majorVersion,
            'minorVersion'       => $this->minorVersion,
            'browserWithVersion' => $this->browserWithVersion,
            'publisher'          => $this->publisher,
            'platform'           => $this->platform,
            'device'             => $this->device,
            'devicePointer'      => $this->devicePointer,
            'isMobile'           => $this->isMobile,
            'isTablet'           => $this->isTablet(),
            'isCrawler'          => $this->isCrawler,
        ];
    }
356430
public function toArray()
    {
        return [
            'title' => $this->title,
            'description' => $this->description,
            'commission' => $this->commission,
            'costCentre' => $this->costCentre,
            'currencyCode' => $this->currencyCode,
            'netShippingCosts' => $this->netShippingCosts,
            'internalNote' => $this->getInternalNote(),
            'responsibleContact' => $this->createDataArray($this->responsibleContact),
            'items' => $this->itemsToArray(),
        ];
    }
50109
public function toArray(): array
    {
        if (!empty($this->warnings)) {
            $this->status = 'warning';
        } elseif (!empty($this->errors)) {
            $this->status = 'error';
        }

        return [
            'status' => $this->status,
            'errors' => array_merge(array_map(function($x) {
                return ['severity' => 'error', 'message' => $x];
            }, $this->errors), array_map(function($x) {
                return ['severity' => 'warning', 'message' => $x];
            }, $this->warnings)),
            'info' => $this->info
        ];
    }
1082995
public function getValidators()
    {
        $this->validators = $this->generateInputs();

        $translatedInputs = [];

        foreach ($this->validators as $key => $validator) {
            $translatedOperators = [];

            foreach ($validator['availableOperators'] as $availableOperators) {
                $translatedOperators[$availableOperators] = Operators::getI18n(
                    $this->translator,
                    $availableOperators
                );
            }

            $validator['availableOperators'] = $translatedOperators;

            $translatedInputs[$key] = $validator;
        }

        $validators = [
            'inputs'       => $translatedInputs,
            'setOperators' => $this->operators,
            'setValues'    => $this->values
        ];

        return $validators;
    }
467559
public function toArray(): array
    {
        return array_filter([
            'field' => 'uuid.type' === $this->field
                ? null
                : $this->field,
            'values' => $this->values,
            'application_type' => self::AT_LEAST_ONE === $this->applicationType
                ? null
                : $this->applicationType,
            'filter_type' => self::TYPE_FIELD === $this->filterType
                ? null
                : $this->filterType,
            'filter_terms' => $this->filterTerms,
        ], function ($element) {
            return
            !(
                is_null($element) ||
                (is_array($element) && empty($element))
            );
        });
    }
735583
public function toArray()
    {
        return [
            'id'          => $this->id,
            'module'      => $this->module,
            'bundle'      => $this->bundle,
            'position'    => $this->position,
            'name'        => $this->name,
            'description' => $this->description,
            'category'    => $this->category,
            'active'      => $this->active,
            'tags'        => $this->tags
        ];
    }
1168483
public function getArray()
    {
        $current_folder_id  = $this->get('cms.context')->getCurrentFolderId();
        $router             = $this->get('router');
        $t                  = $this->get('translator');

        // @todo кеширование по языку и юзеру.
        $data = [
            'left' => [
                'administration' => [
                    'title' => $t->trans('Administration'),
                    'descr' => '',
                    'icon' => 'admin',
                    'onlyicon' => true,
                    'uri'   => $router->generate('cms_admin_index'),
                ],
                'menu' => [
                    'title' => $t->trans('Menu'),
                    'descr' => '',
                    'icon' => 'menu',
                    'items' => [
                        'structure' => [
                            'title' => $t->trans('Site structure'),
                            'icon'  => 'structure',
                            'uri'   => $router->generate('cms_admin_structure'),
                        ],
                        'modules' => [
                            'title' => $t->trans('Modules'),
                            'icon'  => 'modules',
                            'uri'   => $router->generate('cms_admin_module'),
                        ],
                        'files' => [
                            'title' => $t->trans('Files'),
                            'icon'  => 'file',
                            'uri'   => $router->generate('cms_admin_files'),
                        ],
                        'regions' => [
                            'title' => $t->trans('Regions'),
                            'icon'  => 'area',
                            'uri'   => $router->generate('cms_admin_structure_region'),
                        ],
                        'users' => [
                            'title' => $t->trans('Users'),
                            'icon'  => 'users',
                            'uri'   => $router->generate('cms_admin_user'),
                        ],
                        'config' => [
                            'title' => $t->trans('Configuration'),
                            'icon'  => 'conf',
                            'uri'   => $router->generate('smart_core_settings'),
                        ],
                        'appearance' => [
                            'title' => $t->trans('Appearance'),
                            'icon'  => 'code',
                            'uri'   => $router->generate('cms_admin_appearance'),
                        ],
                        'reports' => [
                            'title' => $t->trans('Reports'),
                            'icon' => 'report',
                            'uri' => $router->generate('cms_admin_reports'),
                        ],
                        /*
                        'help' => [
                            'title' => $t->trans('Help'),
                            'icon' => 'question-sign',
                            'uri' => $router->generate('cms_admin_help'),
                        ],
                        */
                    ],
                ],
                'structure' => [
                    'title' => '',
                    'descr' => $t->trans('Structure'),
                    'icon'  => 'folder',
                    'onlyicon' => true,
                    'items' => [
                        'folder_edit' => [
                            'title' => $t->trans('Edit folder'),
                            'icon'  => 'edit-toolbar',
                            'uri'   => $router->generate('cms_admin_structure_folder', ['id' => $current_folder_id]),
                        ],
                        'folder_new' => [
                            'title' => $t->trans('Create folder'),
                            'icon'  => 'add',
                            'uri'   => $router->generate('cms_admin_structure_folder_create_in_folder', ['parent' => $current_folder_id]),
                        ],
                        'add_module' => [
                            'title' => $t->trans('Add module'),
                            'icon'  => 'add',
                            'uri'   => $router->generate('cms_admin_structure_node_create_in_folder', ['folder_pid' => $current_folder_id]),
                        ],
                    ],
                ],
            ],
            'right' => [
                //'eip_toggle' => ['Режим правки: ОТКЛ', 'Режим правки: ВКЛ.'], // @todo перевод // [$t->trans('Viewing'), $t->trans('Edit')],
                'user' => [
                    'title' => $this->container->get('security.token_storage')->getToken()->getUser()->getUserName(),
                    'icon' => 'user-setting',
                    'items' => [
                        /*
                        'admin' => [
                            'title' => $t->trans('Control panel'),
                            'uri'   => $router->generate('cms_admin_index'),
                            'icon'  => 'cog',
                            'overalay' => false,
                        ],
                        */
                        'profile' => [
                            'title' => $t->trans('My profile'),
                            'uri'   => $router->generate('cms_admin_user_edit', ['id' => $this->container->get('security.token_storage')->getToken()->getUser()->getId()]),
                            'icon'  => 'profile',
                            'overalay' => false,
                        ],
                        'logout' => [
                            'title' => $t->trans('Logout'),
                            'uri'   => $router->generate('cms_admin_logout'),
                            'icon'  => 'exit',
                            'overalay' => false,
                        ],
                    ],
                ],
            ],
            'notifications' => [],
        ];

        foreach ($this->get('cms.node')->getNodes() as $node) {
            if ($node->getControlsInToolbar() == Node::TOOLBAR_ONLY_IN_SELF_FOLDER) {
                foreach ($node->getFrontControls() as $controls) {
                    if (isset($controls['default']) and $controls['default'] == true) {
                        $data['left']['node_'.$node->getId()] = [
                            'title' => $controls['title'],
                            'descr' => isset($controls['descr']) ? $controls['descr'] : '',
                            'uri'   => $controls['uri'],
                        ];
                    }
                }
            }
        }

        foreach ($this->get('cms.module')->all() as $module) {
            $notices = $module->getNotifications();

            if (!empty($notices)) {
                $data['notifications'][$module->getName()] = $notices;
            }
        }

        return $data;
    }
1366959
public function toArray()
    {
        return [
            'success'          => $this->isSuccess(),
            'hostname'         => $this->getHostname(),
            'challenge_ts'     => $this->getChallengeTs(),
            'apk_package_name' => $this->getApkPackageName(),
            'score'            => $this->getScore(),
            'action'           => $this->getAction(),
            'error-codes'      => $this->getErrorCodes(),
        ];
    }
974744
public static function getSavedRoutes()
    {
        $result = [];
        foreach (Yii::$app->getAuthManager()->getPermissions() as $name => $value) {
            if ($name[0] === '/' && substr($name, -1) != '*') {
                $result[] = $name;
            }
        }

        return $result;
    }
1320506
public function getKeys() : array
        {
	        $keys = $this->_redis->hkeys($this->_key);
	        return !empty($keys)?$keys:[];
        }
1205674
public function toArray()
    {
        return array(
            'age' => $this->getAge(),
            'quarter' => $this->getQuarter(),
            'day' => $this->getDay(),
            'month' => $this->getMonth(),
            'year' => $this->getYear(),
            'hour' => $this->getHour(),
            'minute' => $this->getMinute(),
            'second' => $this->getSecond(),
            'microsecond' => $this->getMicrosecond(),
            'timezone' => $this->getTimezone(),
            'timestamp' => $this->getTimestamp(),
            'milliTimestamp' => $this->getMilliTimestamp(),
            'dayOfWeek' => $this->getDayOfWeek(),
            'dayOfYear' => $this->getDayOfYear(),
            'week' => $this->getWeek(),
        );
    }
681890
public function toArray()
    {
        return array(
            'browser_name' => $this->getBrowserName(),
            'browser_version' => $this->getBrowserVersion(),
            'browser_engine' => $this->getBrowserEngine(),
            'operating_system' => $this->getOperatingSystem(),
            'device' => $this->getDevice()
        );
    }
967484
public function toArray()
    {
        return array_merge(
            [
                'linha_digitavel' => $this->getLinhaDigitavel(),
                'codigo_barras' => $this->getCodigoBarras(),
                'beneficiario' => [
                    'nome' => $this->getBeneficiario()->getNome(),
                    'endereco' => $this->getBeneficiario()->getEndereco(),
                    'bairro' => $this->getBeneficiario()->getBairro(),
                    'cep' => $this->getBeneficiario()->getCep(),
                    'uf' => $this->getBeneficiario()->getUf(),
                    'cidade' => $this->getBeneficiario()->getCidade(),
                    'documento' => $this->getBeneficiario()->getDocumento(),
                    'nome_documento' => $this->getBeneficiario()->getNomeDocumento(),
                    'endereco2' => $this->getBeneficiario()->getCepCidadeUf(),
                    'endereco_completo' => $this->getBeneficiario()->getEnderecoCompleto(),
                ],
                'logo_base64' => $this->getLogoBase64(),
                'logo' => $this->getLogo(),
                'logo_banco_base64' => $this->getLogoBancoBase64(),
                'logo_banco' => $this->getLogoBanco(),
                'codigo_banco' => $this->getCodigoBanco(),
                'codigo_banco_com_dv' => $this->getCodigoBancoComDv(),
                'especie' => 'R$',
                'data_vencimento' => $this->getDataVencimento(),
                'data_processamento' => $this->getDataProcessamento(),
                'data_documento' => $this->getDataDocumento(),
                'data_desconto' => $this->getDataDesconto(),
                'valor' => Util::nReal($this->getValor(), 2, false),
                'desconto' => Util::nReal($this->getDesconto(), 2, false),
                'multa' => Util::nReal($this->getMulta(), 2, false),
                'juros' => Util::nReal($this->getJuros(), 2, false),
                'juros_apos' => $this->getJurosApos(),
                'dias_protesto' => $this->getDiasProtesto(),
                'sacador_avalista' =>
                    $this->getSacadorAvalista()
                        ? [
                        'nome' => $this->getSacadorAvalista()->getNome(),
                        'endereco' => $this->getSacadorAvalista()->getEndereco(),
                        'bairro' => $this->getSacadorAvalista()->getBairro(),
                        'cep' => $this->getSacadorAvalista()->getCep(),
                        'uf' => $this->getSacadorAvalista()->getUf(),
                        'cidade' => $this->getSacadorAvalista()->getCidade(),
                        'documento' => $this->getSacadorAvalista()->getDocumento(),
                        'nome_documento' => $this->getSacadorAvalista()->getNomeDocumento(),
                        'endereco2' => $this->getSacadorAvalista()->getCepCidadeUf(),
						'endereco_completo' => $this->getSacadorAvalista()->getEnderecoCompleto(),
                    ]
                        : [],
                'pagador' => [
                    'nome' => $this->getPagador()->getNome(),
                    'endereco' => $this->getPagador()->getEndereco(),
                    'bairro' => $this->getPagador()->getBairro(),
                    'cep' => $this->getPagador()->getCep(),
                    'uf' => $this->getPagador()->getUf(),
                    'cidade' => $this->getPagador()->getCidade(),
                    'documento' => $this->getPagador()->getDocumento(),
                    'nome_documento' => $this->getPagador()->getNomeDocumento(),
                    'endereco2' => $this->getPagador()->getCepCidadeUf(),
					'endereco_completo' => $this->getPagador()->getEnderecoCompleto(),
                ],
                'demonstrativo' => $this->getDescricaoDemonstrativo(),
                'instrucoes' => $this->getInstrucoes(),
                'instrucoes_impressao' => $this->getInstrucoesImpressao(),
                'local_pagamento' => $this->getLocalPagamento(),
                'numero' => $this->getNumero(),
                'numero_documento' => $this->getNumeroDocumento(),
                'numero_controle' => $this->getNumeroControle(),
                'agencia_codigo_beneficiario' => $this->getAgenciaCodigoBeneficiario(),
                'nosso_numero' => $this->getNossoNumero(),
                'nosso_numero_boleto' => $this->getNossoNumeroBoleto(),
                'especie_doc' => $this->getEspecieDoc(),
                'especie_doc_cod' => $this->getEspecieDocCodigo(),
                'aceite' => $this->getAceite(),
                'carteira' => $this->getCarteira(),
                'carteira_nome' => $this->getCarteiraNome(),
                'uso_banco' => $this->getUsoBanco(),
                'status' => $this->getStatus(),
                'mostrar_endereco_ficha_compensacao' => $this->getMostrarEnderecoFichaCompensacao()
            ], $this->variaveis_adicionais
        );
    }