/** * @param Http\Request\Parameters\Included $included */ protected function filterOutIncludedResources(Included $included) { if (false === $included->isEmpty()) { foreach ($included->get() as $resource => $includeData) { foreach ($this->serializationStrategy->getMappings() as $mapping) { $mapping->filteringIncludedResources(true); if (is_array($includeData)) { foreach ($includeData as $subResource) { $this->serializationStrategy->getMappingByAlias($subResource)->addIncludedResource($this->serializationStrategy->getMappingByAlias($resource)->getClassName()); } break; } $mapping->addIncludedResource($this->serializationStrategy->getMappingByAlias($resource)->getClassName()); } } } }
/** * @param JsonApiSerializer $serializer * @param Included $included * @param string $paramName */ protected function validateIncludeQueryParamsTypes($serializer, Included $included, $paramName) { if (false === $included->isEmpty()) { $validateFields = array_keys($included->get()); foreach ($validateFields as $key => $field) { $mapping = $serializer->getTransformer()->getMappingByAlias($field); if (null !== $mapping) { $properties = $this->getPropertiesFromMapping($mapping); $invalidProperties = array_diff($included->get()[$field], $properties); $this->addInvalidParameterMemberErrorsToErrorBag($invalidProperties, $paramName, $field); unset($validateFields[$key]); } } $this->addInvalidParameterErrorsToErrorBag($paramName, $validateFields); } }
public function testIsEmpty() { $this->assertFalse($this->included->isEmpty()); }