Skip to content
Snippets Groups Projects
Commit a524eb21 authored by Claudiu Cristea's avatar Claudiu Cristea
Browse files

ISAICP-9013: Fix the ID redirector.

parent d2a4fe21
No related branches found
No related tags found
1 merge request!182Release v1.111.1
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
namespace Drupal\joinup_core\Controller; namespace Drupal\joinup_core\Controller;
use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Controller\ControllerBase;
use Drupal\joinup_distribution\Entity\Distribution; use Drupal\joinup_rdf\Entity\RdfSyncEntityInterface;
use Drupal\joinup_licence\Entity\Licence; use Drupal\joinup_solution\Entity\SolutionInterface;
use Drupal\rdf_sync\RdfSyncMapper; use Drupal\rdf_sync\RdfSyncMapper;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
...@@ -56,21 +56,16 @@ public function redirectToRdfEntity(string $namespace, string $uuid): RedirectRe ...@@ -56,21 +56,16 @@ public function redirectToRdfEntity(string $namespace, string $uuid): RedirectRe
$uuid = urldecode($uuid); $uuid = urldecode($uuid);
$id = "http://data.europa.eu/$namespace/$uuid"; $id = "http://data.europa.eu/$namespace/$uuid";
if ($entity_type_id === 'taxonomy_term') {
if (!$term = $this->mapper->getEntityByUri($id)) {
return $this->redirect('joinup_core.not_found');
}
$id = $term->id();
}
// @todo This a temporary solution during conversion of RDF entities to // @todo This a temporary solution during conversion of RDF entities to
// nodes. Convert to a stable solution in ISAICP-8376. // nodes. Convert to a stable solution in ISAICP-8376.
elseif ($licence = Licence::loadByUri($id)) { if ($entity = $this->mapper->getEntityByUri($id)) {
$entity_type_id = 'node'; // @todo Remove the solution stub exception in ISAICP-8572.
$id = $licence->id(); if (!$entity instanceof SolutionInterface) {
} assert($entity instanceof RdfSyncEntityInterface);
elseif ($distribution = Distribution::loadByUri($id)) { $entity_type_id = $entity->getEntityTypeId();
$entity_type_id = 'node'; $id = $entity->id();
$id = $distribution->id(); }
} }
return $this->redirect("entity.$entity_type_id.canonical", [ return $this->redirect("entity.$entity_type_id.canonical", [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment