/**
  * It should allow values to be set and retrieved.
  */
 public function testGetSet()
 {
     $this->description->set(Descriptor::TYPE_ALIAS, 'page');
     $this->description->set(Descriptor::LINK_EDIT_HTML, '/path/to/edit');
     $this->description->set('custom.key', 'Hello');
     $this->assertEquals('page', $this->description->get(Descriptor::TYPE_ALIAS));
     $this->assertTrue($this->description->has(Descriptor::TYPE_ALIAS));
     $this->assertFalse($this->description->has('hello'));
     $this->assertEquals([Descriptor::TYPE_ALIAS => 'page', Descriptor::LINK_EDIT_HTML => '/path/to/edit', 'custom.key' => 'Hello'], $this->description->all());
 }
 /**
  * {@inheritdoc}
  */
 public function enhance(Description $description)
 {
     $metadata = $this->registry->getByClass($description->getResource()->getPayloadType());
     $payload = $description->getResource()->getPayload();
     // the request configuration provides the route names.
     $request = $this->requestStack->getCurrentRequest();
     $configuration = $this->requestConfigurationFactory->create($metadata, $request);
     $map = [Descriptor::LINK_SHOW_HTML => 'show', Descriptor::LINK_LIST_HTML => 'index', Descriptor::LINK_EDIT_HTML => 'update', Descriptor::LINK_CREATE_HTML => 'create', Descriptor::LINK_REMOVE_HTML => 'delete'];
     foreach ($map as $descriptor => $action) {
         // note that some resources may not have routes
         // registered with sonata (f.e. folder resources)
         // so we ignore route-not-found exceptions.
         try {
             $url = $this->urlGenerator->generate($configuration->getRouteName($action), ['id' => $payload->getId()]);
             $description->set($descriptor, $url);
         } catch (RouteNotFoundException $e) {
         }
     }
     // if a previous enhancer has set the children types descriptor, then
     // we can generate the LINKS_CREATE_CHILD_HTML descriptor.
     if ($description->has(Descriptor::CHILDREN_TYPES)) {
         $this->processChildrenTypes($description, $metadata, $request, $payload);
     }
 }