-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[NFR] Name property for Phalcon\Mvc\Router\Group #1682
Comments
Implemented in 1.3.0, could you please take a look? |
@sjinks Odd, but I'm getting Fatal error: Call to undefined method Phalcon\Mvc\Router\Route::getGroup() even though I've built out the 1.3.0 branch. I also can't see a _group attribute on the Phalcon\Mvc\Router\Route object. 1.3.0 BETA 1
Phalcon\Mvc\Router\Route Object
(
[_pattern:protected] => /{locale:[a-z]{2,3}([\_\-][[:alnum:]]{1,8})?}/:controller/:action/:params
[_compiledPattern:protected] => #^/[a-z]{2,3}([\_\-][[:alnum:]]{1,8})?/([a-zA-Z0-9_-]++)/([a-zA-Z0-9_-]++)(/.*+)?+$#
[_paths:protected] => Array
(
[controller] => 2
[action] => 3
[params] => 4
[locale] => 1
)
[_methods:protected] =>
[_hostname:protected] =>
[_converters:protected] =>
[_id:protected] => 7
[_name:protected] => LocaleAwareRoute
[_beforeMatch:protected] =>
) |
Did you build 1.3.0 from build/ or from ext/? |
build/ Wrong place? :-) |
my bad - forgot to run gen-build.php. I now have the group object, but there is no way to identify if it's the right group. The NFR was also to get a setName()/getName() on the Group object. |
@sjinks Should I close this out? I was really hoping that Phalcon\Mvc\Router\Group would get a getName()/setName() |
Allow users to setName() on a group as is done for individual routes. Individual routes should have a groupName attribute that contains this, or have a getGroup() function on Phalcon\Mvc\Router\Route that returns the Phalcon\Mvc\Router\Group object.
This would be useful when doing a getMatchedRoute() to be able to code logic based off of the group the matched route belongs to. I am currently writing a Locale class that does URL rewriting. All of my locale-aware routes are in one group and I want to check if the incoming URL already matches one of those routes our not.
Current Workaround: I'm using setName() on all the routes in the group to name them the same thing.
The text was updated successfully, but these errors were encountered: