return a list of announcements from the root associations

@param \RGU\Dvoconnector\Service\ApiServiceFilterContext $apiServiceFilterContext

@return array XML data
971540
public function getAnnouncementsFromRootAssociations($apiServiceFilterContext = null)
    {
        $result = [];

        foreach ($this->getRootAssociationIDs() as $key => $rootAssociationID) {
            try {
                $result[] = $this->getAnnouncementsFromAssociation($rootAssociationID, $apiServiceFilterContext);
            } catch (ContextException $e) {
                if ($key === count($this->getRootAssociationIDs()) - 1) {
                    throw $e;
                }
            }
        }

        return $result;
    }
972233
public function getRootAssociations($associationsFilter = null)
    {
        $arrayWithChilds = $this->associationsApiService->getRootAssociations($associationsFilter);

        $associations = new Associations();

        foreach ($arrayWithChilds as $xmlQuery) {
            $association = new Association();

            $mapper = new \RGU\Dvoconnector\Mapper\Association($xmlQuery);
            $mapper->mapToAbstractEntity($association);

            $associations->addAssociation($this->completeEntity($association));
        }

        return $this->completeEntity($associations);
    }
1361833
public function getFunctionariesFromRootAssociations($apiServiceFilterContext = null)
    {
        $result = [];

        foreach ($this->getRootAssociationIDs() as $key => $rootAssociationID) {
            try {
                $result[] = $this->getFunctionariesFromAssociation($rootAssociationID, $apiServiceFilterContext);
            } catch (ContextException $e) {
                if ($key === count($this->getRootAssociationIDs()) - 1) {
                    throw $e;
                }
            }
        }

        return $result;
    }
1232881
private function getProxySettings(RequestContext $context): array
    {
        $proxy = [];

        if (!is_null($context->getProxy())) {
            $proxy[CURLOPT_PROXY] = $context->getProxy();
        }

        return $proxy;
    }
1142902
public function getServiceIds()
    {
        return array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds()));
    }
448401
public function listAction($context = null)
    {
        $widgets = $this->manager->getAvailable($context);

        return new JsonResponse(array_map(function (DataSource $dataSource) {
            return $this->serializer->serialize($dataSource);
        }, $widgets));
    }
732187
public static function getAttributes(array $data, JsonApiSerializer $serializer)
    {
        $mapping = $serializer->getTransformer()->getMappingByAlias($data[JsonApiTransformer::TYPE_KEY]);
        $aliases = $mapping->getAliasedProperties();
        $keys = str_replace(
            array_values($aliases),
            array_keys($aliases),
            array_keys($data[JsonApiTransformer::ATTRIBUTES_KEY])
        );

        return array_combine($keys, array_values($data[JsonApiTransformer::ATTRIBUTES_KEY]));
    }
378503
public function getFunctionariesFromAssociation($aid, $apiServiceFilterContext = null)
    {
        $apiServiceFilterContext = $this->checkApiServiceFilterContext($apiServiceFilterContext, $aid);

        $url = $this->getBaseApiUrl() . '/associations/' . $aid . '/functionaries';

        $params = null;

        $xml = $this->queryXml($url, $apiServiceFilterContext);

        $this->checkValidContext($xml->list[self::CO_XML_ATTRIBUT_VALID_CONTEXT]);

        $filterParamters = $apiServiceFilterContext->getParametersArray();

        for ($i = 0; $i < count($xml->list->functionaries->functionary); $i++) {
            $functionaryChildEntry = $xml->list->functionaries->functionary[$i];

            if (isset($filterParamters['f_role']) && preg_match('/(' . $filterParamters['f_role'] . ')/', $functionaryChildEntry['role']) == 0) {
                unset($xml->list->functionaries->functionary[$i]);
                $i--;
            } else {
                $functionaryChildEntry->addAttribute('associationid', $aid);
            }
        }

        return $xml->list;
    }
687517
public function getAssociatedTags(EntityDefinition $definition, Entity $entity, Context $context): array
    {
        $associations = $definition->getFields()->filterInstance(AssociationField::class);

        $keys = [$this->getEntityTag($entity->getUniqueIdentifier(), $definition)];

        foreach ($context->getLanguageIdChain() as $languageId) {
            $keys[] = $this->getEntityTag($languageId, $this->languageDefinition);
        }

        $translationDefinition = $definition->getTranslationDefinition();

        if ($translationDefinition) {
            /* @var EntityDefinition $translationDefinition */
            $keys[] = $translationDefinition->getEntityName() . '.language_id';
        }

        /** @var AssociationField[] $associations */
        foreach ($associations as $association) {
            if ($association->is(Extension::class)) {
                $value = $entity->getExtension($association->getPropertyName());
            } else {
                try {
                    $value = $entity->get($association->getPropertyName());
                } catch (\Exception $e) {
                    continue;
                }
            }

            if (!$value) {
                continue;
            }

            if ($association instanceof ManyToOneAssociationField || $association instanceof OneToOneAssociationField) {
                /* @var Entity $value */
                $nested = $this->getAssociatedTags($association->getReferenceDefinition(), $value, $context);
                foreach ($nested as $key) {
                    $keys[] = $key;
                }

                continue;
            }

            if ($association instanceof OneToManyAssociationField) {
                /** @var Entity[] $value */
                foreach ($value as $item) {
                    $nested = $this->getAssociatedTags($association->getReferenceDefinition(), $item, $context);
                    foreach ($nested as $key) {
                        $keys[] = $key;
                    }
                }

                continue;
            }

            if ($association instanceof ManyToManyAssociationField) {
                /** @var Entity[] $value */
                foreach ($value as $item) {
                    $nested = $this->getAssociatedTags($association->getToManyReferenceDefinition(), $item, $context);
                    foreach ($nested as $key) {
                        $keys[] = $key;
                    }
                }
            }
        }

        return array_keys(array_flip($keys));
    }
134398
public function findAnnouncementsByAssociation($association, $announcementsFilter = null)
    {
        $xmlQuery = $this->associationsApiService->getAnnouncementsFromAssociation($association->getID(), $announcementsFilter);

        $announcements = new Announcements();

        $mapper = new \RGU\Dvoconnector\Mapper\Announcements($xmlQuery);
        $mapper->mapToAbstractEntity($announcements);

        return $this->completeEntity($announcements);
    }
1348967
public function serializePayload(ControllerContext $controllerContext)
    {
        $node = $this->getNode();
        $redirectUri = $this->linkingService->createNodeUri($controllerContext, $node, null, null, true, [], '', false, [], false);

        return [
            'redirectUri' => $redirectUri,
            'redirectContextPath' => $node->getContextPath()
        ];
    }
433448
protected function getUriInformation(NodeInterface $node, ControllerContext $controllerContext): array
    {
        $nodeInfo = [];
        if (!$node->getNodeType()->isOfType($this->documentNodeTypeRole)) {
            return $nodeInfo;
        }

        try {
            $nodeInfo['uri'] = $this->createRedirectToNode($controllerContext, $node);
        } catch (\Neos\Flow\Mvc\Routing\Exception\MissingActionNameException $exception) {
            // Unless there is a serious problem with routes there shouldn't be an exception ever.
            $nodeInfo['uri'] = '';
        }

        return $nodeInfo;
    }
1332964
protected function getExistingFiltersWithoutCurrentCallback(string $callbackUrl, User $user): array
    {
        $allCurrentNotificationFilter = $user->getBunqUser()->getNotificationFilters();
        $allUpdatedNotificationFilter = [];

        foreach ($allCurrentNotificationFilter as $notificationFilter) {
            if ($notificationFilter->getNotificationTarget() !== $callbackUrl) {
                $allUpdatedNotificationFilter[] = $notificationFilter;
            }
        }

        return $allUpdatedNotificationFilter;
    }
564155
public function getFunctionaryFromAssociation($aid, $fid, $apiServiceFilterContext = null)
    {
        $apiServiceFilterContext = $this->checkApiServiceFilterContext($apiServiceFilterContext, $aid);

        $url = $this->getBaseApiUrl() . '/associations/' . $aid . '/functionaries/' . $fid . '';

        $params = null;

        $xml = $this->queryXml($url, $apiServiceFilterContext);

        $this->checkValidContext($xml->query[self::CO_XML_ATTRIBUT_VALID_CONTEXT]);

        return $xml->query->children()[0];
    }
126689
private function getCurlTimeoutSettings(RequestContext $context): array
    {
        $timeoutOptions = [];

        $timeout = $context->getTimeout();

        $timeoutOptions += $this->fillTimeoutOptions($timeout, CURLOPT_TIMEOUT, CURLOPT_TIMEOUT_MS);

        $connectionTimeout = $context->getConnectionTimeout();

        $timeoutOptions += $this->fillTimeoutOptions(
            $connectionTimeout, //@codeCoverageIgnore
            CURLOPT_CONNECTTIMEOUT,
            CURLOPT_CONNECTTIMEOUT_MS
        );

        return $timeoutOptions;
    }
1103920
public function getList()
    {
        /** @var RcmUserService $rcmUserService */
        $rcmUserService = $this->serviceLocator->get(RcmUserService::class);

        //ACCESS CHECK
        if (!$rcmUserService->isAllowed(
            ResourceName::RESOURCE_SITES,
            'admin'
        )
        ) {
            $this->getResponse()->setStatusCode(Response::STATUS_CODE_401);
            return $this->getResponse();
        }

        $themes = $this->getThemesConfig();

        return new ApiJsonModel($themes, 0, 'Success');
    }
1367220
public function getAutomaticPromotions(SalesChannelContext $context): EntityCollection
    {
        // add conditional OR filter to either get an entry that matches any existing rule,
        // or promotions that don't have ANY rules and thus are used globally
        $criteria = new Criteria([]);
        $criteria->addFilter(new MultiFilter(
            MultiFilter::CONNECTION_AND,
            [
                new EqualsFilter('useCodes', false),
                new EqualsFilter('active', true),
                new EqualsFilter('promotion.salesChannels.salesChannelId', $context->getSalesChannel()->getId()),
                $this->getDateRangeFilter(),
            ]
        ));

        $criteria->addAssociation('personaRules');
        $criteria->addAssociation('personaCustomers');
        $criteria->addAssociation('cartRules');
        $criteria->addAssociation('orderRules');
        $criteria->addAssociation('discounts');

        /* @var EntityCollection $result */
        $result = $this->promotionRepository->search($criteria, $context->getContext())->getEntities();

        return $result;
    }