Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hal Link not supporting templated links #2

Open
weierophinney opened this issue Dec 31, 2019 · 0 comments
Open

Hal Link not supporting templated links #2

weierophinney opened this issue Dec 31, 2019 · 0 comments

Comments

@weierophinney
Copy link
Contributor

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?


Originally posted by @Wilt at zfcampus/zf-hal#174

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

No branches or pull requests

1 participant