Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Hal Link not supporting templated links #174

Open
Wilt opened this issue Mar 21, 2019 · 1 comment
Open

Hal Link not supporting templated links #174

Wilt opened this issue Mar 21, 2019 · 1 comment

Comments

@Wilt
Copy link
Contributor

Wilt commented Mar 21, 2019

I noticed that templated links are still not supported in ZF-Hal. We are already using templated links for a long time inside our customized version of this library, what is the reason that templated links are not yet supported?

Is it because of issues with rendering the curly brackets or braces so { and } ?
If that is the case, we simply solved this issue by adding a decodeCurlyBrackets to the LinkExtractor class:

if($object->isTemplated()){
    self::decodeCurlyBrackets($representation['href']);
}

And inside the decoder method:

/**
 * We need to decode curly brackets that are used for link templating.
 * They are encoded automatically by the url view helper.
 *
 * @param $string
 * @return string
 */
private static function decodeCurlyBrackets(&$string)
{
    $string = str_replace('%7B', '{' , $string);
    $string = str_replace('%7D', '}' , $string);
    return $string;
}

Could we add such a feature which is an essential part of the Hal standard?

@Wilt Wilt changed the title LinkExtractor not supporting templated links Hal Link not supporting templated links Mar 21, 2019
@weierophinney
Copy link
Member

This repository has been closed and moved to laminas-api-tools/api-tools-hal; a new issue has been opened at laminas-api-tools/api-tools-hal#2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants