public function executeOrg($request) { if ($id = $request->getParameter('id')) { //id given, we check that the id exists $this->checkEntity($request); $this->forward404Unless($this->entity['primary_ext'] == 'Org'); //check that the entity has the given name $name = LsSlug::convertSlugToName($request->getParameter('slug')); //if the name isn't primary, we redirect to the url with the primary name if ($this->entity->rawGet('name') != $name) { $params = $request->getParameterHolder()->getAll(); if ($params['target'] == 'view') { $params['target'] = null; } $url = EntityTable::generateRoute($this->entity, $params['target'], $params); $this->redirect($url); } } else { $entities = EntityTable::getBySlug($request->getParameter('slug'), 'Org', $useAliases = true); switch ($q->count()) { case 0: $this->forward404(); break; case 1: $this->entity = $entities[0]; $request->setParameter('id', $this->entity->id); break; default: $request->setParameter('extension', 'Org'); $this->forward('entity', 'disambiguation'); break; } } $this->forward('entity', $request->getParameter('target', 'view')); }