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

Hal Link not supporting templated links #174

Description

@Wilt

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions