/** * {@inheritDoc} */ public function assemble(Event $event) { $uri = $event->getUri(); $locale = $event->getLocale(); $query = $uri->getQueryAsArray(); $key = $this->getQueryKey(); $query[$key] = $locale; $uri->setQuery($query); return $uri; }
/** * {@inheritDoc} */ public function assemble(Event $event) { $uri = $event->getUri(); $base = $this->getBasePath(); $locale = $event->getLocale(); $current = $this->getFirstSegmentInPath($uri, $base); if (!$this->redirectToCanonical() && $this->getAliases()) { $alias = $this->getAliasForLocale($locale); if (null !== $alias) { $locale = $alias; } } $path = $uri->getPath(); // Last part of base is now always locale, remove that $parts = explode('/', trim($base, '/')); array_pop($parts); $base = implode('/', $parts); if ($base) { $path = substr($path, strlen($base)); } $parts = explode('/', trim($path, '/')); // Remove first part array_shift($parts); $path = $base . '/' . $locale . '/' . implode('/', $parts); $uri->setPath($path); return $uri; }