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

Resource matcher routing (rewrite) #76

Closed
wants to merge 12 commits into from

Conversation

Ocramius
Copy link
Member

Supersedes #72

  • Moving matching of associations (and generic hops in the URL) to a recursive matcher that assembles a SubPathMatch object
  • Moving single types of match to own sub-path matchers
  • Consider using the "part" route for sub-paths
  • Producing a SubPathMatch with all previous sub-path matches in it
  • Assembling of a full URL from a given SubPathMatch
  • Pluggable collection filtering logic (when reaching the path's end, if the leaf is a collection, it may be filtered based on custom rules)
  • Tests

*/
public function matchSubPath(ResourceInterface $resource, $subPath, Request $request)
{
if ($resource->isCollection()) {
Copy link
Member

Choose a reason for hiding this comment

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

Is this check really needed ? It's already taken care in the BaseSubPathMatcher.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't assume this will always be used with the BaseSubPathMatcher

@bakura10
Copy link
Member

Looks good otherwise :). Please, when you'll plug this to the ResourceGraphRoute, rename it to RestResourceRoute also while you're at it ;-).

@bakura10
Copy link
Member

I'm taking this branch. I'm refactoring ZfrRest right now in this branch: https://github.com/zf-fr/zfr-rest/tree/voltaire

I've taken your code, added some things and currently writing tests for it. So I will close yours.

@bakura10 bakura10 closed this Oct 11, 2013
@bakura10
Copy link
Member

@Ocramius : regarding the filtering issue, here is how I did it: https://github.com/zf-fr/zfr-rest/blob/voltaire/src/ZfrRest/Mvc/Router/Http/Matcher/CollectionSubPathMatcher.php#L149-L158

Using events seems the only flexible way to be able to implement custom logic. What do you think?

@bakura10 bakura10 deleted the feature/resource-matcher-routing branch January 14, 2014 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants