public function it_should_get_tenant_aware_prefixes(TenantAwarePathBuilderInterface $pathBuilder) { $pathsNames = ['routes', 'custom']; $this->setRoutePathsNames($pathsNames); $pathBuilder->build($pathsNames)->willReturn(['/swp/default/routes', '/swp/default/custom']); $this->setPathBuilder($pathBuilder); $this->getPrefixes()->shouldReturn(['/swp/default/routes', '/swp/default/custom']); }
/** * {@inheritdoc} */ public function generate($name, $parameters = [], $referenceType = false) { if (null === $name && isset($parameters['content_id'])) { $contentId = $this->checkAndRemoveFirstSlash($parameters['content_id']); $parameters['content_id'] = $this->pathBuilder->build('/', $contentId); } if (is_string($name)) { $name = (string) $this->pathBuilder->build($this->checkAndRemoveFirstSlash($name)); } return parent::generate($name, $parameters, $referenceType); }
private function generateBasePaths(SessionInterface $session, array $tenants = []) { $basePaths = []; foreach ($tenants as $tenant) { foreach ($this->paths as $path) { $basePaths[] = $this->pathBuilder->build($path, $tenant->getOrganization()->getCode() . '/' . $tenant->getCode()); } } if (count($basePaths) > 0) { $this->createBasePaths($session, $basePaths); } }
/** * {@inheritdoc} */ public function getPrefixes() { $this->idPrefixes = (array) $this->pathBuilder->build($this->routePathsNames); return $this->idPrefixes; }