private function createLinkUrl(LinkMetadata $link, $object)
 {
     $language = new ExpressionLanguage();
     $compiledParams = array();
     foreach ($link->getParams() as $key => $expr) {
         $compiledParams[$key] = $language->evaluate($expr, array('object' => $object));
     }
     return $this->router->generate($link->getRoute(), $compiledParams, true);
 }
 private function createLinkNode(LinkMetadata $link, XmlSerializationVisitor $visitor, $object)
 {
     $language = new ExpressionLanguage();
     $compiledParams = array();
     foreach ($link->getParams() as $key => $expr) {
         $compiledParams[$key] = $language->evaluate($expr, array('object' => $object));
     }
     $linkNode = $visitor->getDocument()->createElement('link');
     $linkNode->setAttribute('id', $link->getName());
     $linkNode->setAttribute('rel', $link->getEntity());
     $linkNode->setAttribute('href', $this->router->generate($link->getRoute(), $compiledParams, true));
     return $linkNode;
 }