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

Fix #1608 about Phalcon\Mvc\Router\Annotations #10274

Merged
merged 2 commits into from
May 9, 2015

Conversation

baryshev
Copy link
Contributor

@baryshev baryshev commented May 7, 2015

Same as #2332.

Fix for #1608 in 2.0.x

@vladimmi
Copy link

vladimmi commented May 7, 2015

/**
* Create the route using the prefix
*/
if typeof value !== "null" {
    if value != "/" {
        let uri = routePrefix . value;
    } else {
        let uri = routePrefix;
        if typeof routePrefix !== "null" {
            let uri = routePrefix;
        } else {
            let uri = value;
        }
    }
} else {
    let uri = routePrefix . actionName;
}

Why cant we just do something like routePrefix . value without additional checks and leave details (like double slashes, etc) to developers? So empty prefix or empty route just had no effect, appended as empty string and / path can be defined as:

  1. empty prefix and / route
    or 2) / prefix and empty route

let uri = routePrefix . actionName; - does this mean that @Route() is equal to @Route('[actionName]')? Have not seen any reference to this in docs. Is this behavior needed and more intuitive than consider empty route as @Route('')?

@baryshev
Copy link
Contributor Author

baryshev commented May 7, 2015

I agree about additional checks. But now we have broken compatibility with 1.3.x.

Constructions like @Route('') or @RoutPrefix('') looks as hacks.

@vladimmi
Copy link

vladimmi commented May 7, 2015

Maybe I was unclear about empty routes... I mean why @Route() is equal to @Route('[action name]') and not to @Route('')? If I leave route empty - that's because I want it to be empty, not equal to action name. And why this behavior is not covered by docs?

That's a question for original developers, however, and I'll post it as an issue, I think.

andresgutierrez added a commit that referenced this pull request May 9, 2015
Fix #1608 about Phalcon\Mvc\Router\Annotations
@andresgutierrez andresgutierrez merged commit 505154f into phalcon:2.0.x May 9, 2015
@andresgutierrez
Copy link
Contributor

Thanks

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

Successfully merging this pull request may close these issues.

3 participants