/** * {@inheritdoc} */ public function apply(Request $request, ParamConverter $configuration) { $name = $configuration->getName(); $country = $this->zonesService->getCountryByIsoCode2Letters($request->get('country')); $inflector = Inflector::get(strtolower($country->getIsoCode2Letters())); $zoneTypeSlug = $inflector->singularize($request->get($name)); $zoneType = $this->zonesService->getZoneTypeFromSlug($zoneTypeSlug, $country); $request->attributes->set('zoneType', $zoneType); return true; }
/** * {@inheritdoc} */ public function apply(Request $request, ParamConverter $configuration) { $name = $configuration->getName(); $country = $request->get('country', null); $inflector = Inflector::get(strtolower($country)); $zoneType = $request->get('zoneType', null); switch (true) { case $zoneType instanceof ZoneType: $zoneType = $inflector->singularize($zoneType->getSlug()); break; case $zoneType != null: $zoneType = $inflector->singularize($zoneType); break; } $slug = $request->get($name); $zone = $this->zonesService->getZoneFromSlug($slug, $zoneType, $country); $request->attributes->set('zone', $zone); return true; }