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

Resources::$placeFormatExtensionBeforeDynamicParts not obeyed. #493

Open
tallsam opened this issue Oct 15, 2015 · 1 comment
Open

Resources::$placeFormatExtensionBeforeDynamicParts not obeyed. #493

tallsam opened this issue Oct 15, 2015 · 1 comment
Assignees

Comments

@tallsam
Copy link

tallsam commented Oct 15, 2015

Hi Arul,

I'm on RC6.

I've set Resources::$placeFormatExtensionBeforeDynamicParts = false; in my index.php
Also tried Explorer::$placeFormatExtensionBeforeDynamicParts = false;

My GET endpoint is showing in Explorer as /v1/weatherstations/nearby.json/{latitude}/{longitude}/{radius}.

I would like it to be /v1/weatherstations/nearby/{latitude}/{longitude}/{radius}.json

Is this possible?

I can get this behaviour by commenting out Resources.php:275-283 but I'm not sure if this has further implications.

                if (count($parts) == 1 && $httpMethod == 'GET') {
                } else {
                    for ($i = 0; $i < count($parts); $i++) {
                        if (strlen($parts[$i]) && $parts[$i]{0} == '{') {
                            $pos = $i - 1;
                            break;
                        }
                    }
                }

Cheers,
Sam.

@tallsam tallsam changed the title Explorer::$placeFormatExtensionBeforeDynamicParts not obeyed. Resources::$placeFormatExtensionBeforeDynamicParts not obeyed. Oct 15, 2015
@Arul- Arul- self-assigned this Oct 15, 2015
@tallsam
Copy link
Author

tallsam commented Oct 16, 2015

My solution was to add a check for $placeFormatExtensionBeforeDynamicParts to the if statement.

} else {
    for ($i = 0; $i < count($parts); $i++) {
        if (strlen($parts[$i]) && $parts[$i]{0} == '{' && !static::$placeFormatExtensionBeforeDynamicParts) {
            $pos = $i - 1;
            break;
        }
    }
}

tallsam pushed a commit to tallsam/Restler-Framework that referenced this issue Oct 16, 2015
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

2 participants