Skip to content

filter routes with the id prefix before doing lookups #186

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

Merged
merged 9 commits into from
Oct 8, 2013

Conversation

lsmith77
Copy link
Member

@lsmith77 lsmith77 commented Oct 7, 2013

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #185
License MIT
Doc PR n/a

@dbu
Copy link
Member

dbu commented Oct 7, 2013

+1, looks good to me. i think this bundle had pretty much 100% code coverage - we probably miss a test.

the existing tests reveal that there are missing sanity checks - see travis.

i think there is a edge case BC break: if somebody relied previously that he would get routes even if they where stored outside the idprefix of this provider. if there are several roots and providers and listeners, things would until now have accidentally worked but will no longer.

maybe we should add a note in the CHANGELOG to aovid headaches over that in case somebody is doing this.

@@ -120,9 +120,11 @@ protected function getCandidates($url)
public function getRouteByName($name, $parameters = array())
{
// $name is the route document path
$route = $this->getObjectManager()->find($this->className, $name);
if ($this->idPrefix && 0 === strpos($name, $this->idPrefix)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it sane that the idPrefix could be null? if its "" then we should stll try to load $name

i think the name could be null or empty however...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed .. it should be if (!$this->idPrefix || 0 === strpos($name, $this->idPrefix)) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cdwlighting can you have a look here?

@dbu
Copy link
Member

dbu commented Oct 7, 2013

i won't merge this with tests failing. but i think it just needs some more sanity checking and then should be good. if it does not make it into 1.1.0 i still think we could consider it a non-BC-breaking performance fix that can go into the 1.1 branch

Chirs Warner and others added 8 commits October 7, 2013 11:43
Fixed getRoutesByName to work if $idPrefix is not defined.
Added Tests to cover those cases.
…es the foreach loop.

 Removed the .idea file from .gitignore
 Added Back the missing getRoutesByNames skipped test.
Created Unit tests for getRoutesByName with defined idPrefix.
lsmith77 added a commit that referenced this pull request Oct 8, 2013
filter routes with the id prefix before doing lookups
@lsmith77 lsmith77 merged commit fcabe73 into master Oct 8, 2013
@lsmith77 lsmith77 deleted the optimize_get_route_by_name branch October 8, 2013 09:04
@dbu
Copy link
Member

dbu commented Oct 8, 2013

thanks a lot @lsmith77 and @cdwlighting !

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