Loading src/DefaultContentManager.php +13 −12 Changes for src/DefaultContentManager.php: 13 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -172,36 +172,37 @@ class DefaultContentManager implements DefaultContentManagerInterface { // Decode the file contents. $decoded = $this->serializer->decode($contents, 'hal_json'); // Get the link to this entity. $self = $decoded['_links']['self']['href']; $item_uuid = $decoded['uuid'][0]['value']; // Throw an exception when this URL already exists. if (isset($file_map[$self])) { if (isset($file_map[$item_uuid])) { $args = array( '@href' => $self, '@first' => $file_map[$self]->uri, '@uuid' => $item_uuid, '@first' => $file_map[$item_uuid]->uri, '@second' => $file->uri, ); // Reset link domain. $this->linkManager->setLinkDomain(FALSE); throw new \Exception(SafeMarkup::format('Default content with href @href exists twice: @first @second', $args)); throw new \Exception(SafeMarkup::format('Default content with uuid @uuid exists twice: @first @second', $args)); } // Store the entity type with the file. $file->entity_type_id = $entity_type_id; // Store the file in the file map. $file_map[$self] = $file; $file_map[$item_uuid] = $file; // Create a vertex for the graph. $vertex = $this->getVertex($self); $this->graph[$vertex->link]['edges'] = []; $vertex = $this->getVertex($item_uuid); $this->graph[$vertex->id]['edges'] = []; if (empty($decoded['_embedded'])) { // No dependencies to resolve. continue; } // Here we need to resolve our dependencies; // Here we need to resolve our dependencies: foreach ($decoded['_embedded'] as $embedded) { foreach ($embedded as $item) { $edge = $this->getVertex($item['_links']['self']['href']); $this->graph[$vertex->link]['edges'][$edge->link] = TRUE; $uuid = $item['uuid'][0]['value']; $edge = $this->getVertex($uuid); $this->graph[$vertex->id]['edges'][$edge->id] = TRUE; } } } Loading Loading @@ -396,7 +397,7 @@ class DefaultContentManager implements DefaultContentManagerInterface { */ protected function getVertex($item_link) { if (!isset($this->vertexes[$item_link])) { $this->vertexes[$item_link] = (object) array('link' => $item_link); $this->vertexes[$item_link] = (object) array('id' => $item_link); } return $this->vertexes[$item_link]; } Loading Loading
src/DefaultContentManager.php +13 −12 Changes for src/DefaultContentManager.php: 13 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -172,36 +172,37 @@ class DefaultContentManager implements DefaultContentManagerInterface { // Decode the file contents. $decoded = $this->serializer->decode($contents, 'hal_json'); // Get the link to this entity. $self = $decoded['_links']['self']['href']; $item_uuid = $decoded['uuid'][0]['value']; // Throw an exception when this URL already exists. if (isset($file_map[$self])) { if (isset($file_map[$item_uuid])) { $args = array( '@href' => $self, '@first' => $file_map[$self]->uri, '@uuid' => $item_uuid, '@first' => $file_map[$item_uuid]->uri, '@second' => $file->uri, ); // Reset link domain. $this->linkManager->setLinkDomain(FALSE); throw new \Exception(SafeMarkup::format('Default content with href @href exists twice: @first @second', $args)); throw new \Exception(SafeMarkup::format('Default content with uuid @uuid exists twice: @first @second', $args)); } // Store the entity type with the file. $file->entity_type_id = $entity_type_id; // Store the file in the file map. $file_map[$self] = $file; $file_map[$item_uuid] = $file; // Create a vertex for the graph. $vertex = $this->getVertex($self); $this->graph[$vertex->link]['edges'] = []; $vertex = $this->getVertex($item_uuid); $this->graph[$vertex->id]['edges'] = []; if (empty($decoded['_embedded'])) { // No dependencies to resolve. continue; } // Here we need to resolve our dependencies; // Here we need to resolve our dependencies: foreach ($decoded['_embedded'] as $embedded) { foreach ($embedded as $item) { $edge = $this->getVertex($item['_links']['self']['href']); $this->graph[$vertex->link]['edges'][$edge->link] = TRUE; $uuid = $item['uuid'][0]['value']; $edge = $this->getVertex($uuid); $this->graph[$vertex->id]['edges'][$edge->id] = TRUE; } } } Loading Loading @@ -396,7 +397,7 @@ class DefaultContentManager implements DefaultContentManagerInterface { */ protected function getVertex($item_link) { if (!isset($this->vertexes[$item_link])) { $this->vertexes[$item_link] = (object) array('link' => $item_link); $this->vertexes[$item_link] = (object) array('id' => $item_link); } return $this->vertexes[$item_link]; } Loading