/** * @param string $type * * @return string[] */ private function getIncludePathsByType($type) { // if include paths are set in params use them otherwise use default include paths from schema $includePaths = $this->parameters->getIncludePaths(); if (empty($includePaths) === false) { $typePaths = $includePaths; } else { $schema = $this->container->getSchemaByResourceType($type); $typePaths = $schema->getIncludePaths(); } return $typePaths; }
/** * @param ErrorCollection $errors * @param EncodingParametersInterface $parameters * * @return array */ public function mapParameters(ErrorCollection $errors, EncodingParametersInterface $parameters) { $filters = $this->mapFilterParameters($errors, $parameters->getFilteringParameters()); $sorts = $this->mapSortParameters($errors, $parameters->getSortParameters()); $includes = $this->mapIncludeParameters($errors, $parameters->getIncludePaths()); $paging = $parameters->getPaginationParameters(); return [$filters, $sorts, $includes, $paging]; }
/** * @param ErrorCollection $errors * @param EncodingParametersInterface $parameters */ protected function checkIncludePaths(ErrorCollection $errors, EncodingParametersInterface $parameters) { $withinAllowed = $this->valuesWithinAllowed($parameters->getIncludePaths(), $this->includePaths); $withinAllowed === true ?: $errors->addQueryParameterError(QP::PARAM_INCLUDE, T::t('Include paths should contain only allowed ones.')); }