Returns the OPTIONS name of a REST route.
public getOptionsRouteName ( Symfony\Component\Routing\Route $route ) : string | ||
$route | Symfony\Component\Routing\Route | Route |
return | string |
/** * Iterates over $restRouteCollection, and returns the corresponding RouteCollection of OPTIONS REST routes * * @param RouteCollection $restRouteCollection * @return RouteCollection */ public function mapCollection(RouteCollection $restRouteCollection) { $optionsRouteCollection = new RouteCollection(); foreach ($restRouteCollection->all() as $restRoute) { $optionsRouteName = $this->mapper->getOptionsRouteName($restRoute); $optionsRoute = $optionsRouteCollection->get($optionsRouteName); if ($optionsRoute === null) { $optionsRoute = $this->mapper->mapRoute($restRoute); } else { $optionsRoute = $this->mapper->mergeMethodsDefault($optionsRoute, $restRoute); } $optionsRouteCollection->add($optionsRouteName, $optionsRoute); } return $optionsRouteCollection; }
public function testGetOptionsRouteName() { $route = new Route('/route/{id}'); self::assertEquals('ezpublish_rest_options_route_{id}', $this->mapper->getOptionsRouteName($route)); }