/** * Handle a push requests' exposure configuration (POST/PUT/PATCH) * @param RouteMetaData $route - the matched route * @param AbstractRepresentation $representation - the representation class to be used * @return AbstractRepresentation $representation */ protected function handlePushExposureConfiguration(RouteMetaData $route, AbstractRepresentation $representation) { $representation = $representation::createFromString($this->request->getBody()); // Write the filtered expose data $representation->write(ExposeFields::create($route)->configureExposeDepth($this->emr, $this->config->getExposureDepth(), $this->config->getExposureRelationsFetchType())->configurePushRequest($representation->toArray())); return $representation; }
/** * Check if the client has requested the CG classes with an OPTIONS call * @return bool */ protected function doCGOptionsCheck() { $genClasses = $this->request->getHeaders(ClassGenerator::HEADER_PARAM); if ($this->request->getHttpMethod() != Request::METHOD_OPTIONS || empty($genClasses)) { return false; } $classGenerator = new ClassGenerator($this->em); $classMetadatas = array(); if (!empty($genClasses)) { foreach ($this->metadataFactory->getAllClassNames() as $className) { $metaData = $this->getClassMetadata($className); foreach ($metaData->getRoutesMetaData() as $route) { /* @var RouteMetaData $route */ $route->setExpose(Query\ExposeFields::create($route)->configureExposeDepth($this->em, $this->config->getExposureDepth(), $this->config->getExposureRelationsFetchType())->toArray()); } $classMetadatas[] = $metaData; } } $classGenerator->create($classMetadatas); $this->response->setBody($classGenerator->serialize()); return true; }
public function testExposureRelationFetchType() { $config = new Configuration(); $config->setExposureRelationsFetchType(\Doctrine\ORM\Mapping\ClassMetadataInfo::FETCH_EAGER); $this->assertEquals(\Doctrine\ORM\Mapping\ClassMetadataInfo::FETCH_EAGER, $config->getExposureRelationsFetchType()); }