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

Added child restriction to Route & RedirectRoute documents #389

Closed
wants to merge 1 commit into from

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Feb 9, 2017

/fixes #386

Builds are failing because of a bug in PHPCR ODM 1.4.0. The fix is already in master, but not yet released as 1.4.1.

@wouterj wouterj added the wip/poc label Feb 9, 2017
@@ -13,6 +13,7 @@
<nodename name="name"/>
<parent-document name="parent"/>
<children name="children"/>
<child-class name="Symfony\Cmf\Component\Routing\RouteObjectInterface"/>
Copy link
Member Author

Choose a reason for hiding this comment

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

We have a couple of options here:

  • Restrict to this interface
  • Restrict to Symfony\Component\Routing\Route
  • Restrict to the Route and RedirectRoute models of this bundle

I choose the first option, as it seems to be the most flexible without completely allowing anything.

@wouterj wouterj force-pushed the issue-386/child-restrictions branch from b29b694 to 02a2349 Compare February 9, 2017 12:02
@wouterj wouterj added this to the 2.0 milestone Feb 9, 2017
@wouterj wouterj force-pushed the issue-386/child-restrictions branch from 02a2349 to a0d34bc Compare February 9, 2017 12:27
@wouterj
Copy link
Member Author

wouterj commented Feb 9, 2017

@dbu this test seems to suggest that adding a non-route document as child of a route is supported: https://github.com/symfony-cmf/routing-bundle/blob/master/tests/Functional/Doctrine/Phpcr/RouteProviderTest.php

Should we allow all childs and only keep using the route filtering in the RouteProvider, or should we remove the filtering in the provider and rely on child restrictions?

Copy link
Member

@dbu dbu left a comment

Choose a reason for hiding this comment

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

i am not sure if we can do this actually. the tree structure translates to urls - the other bundles are only internal representation.

we could have something like /blog/2017/02/09/my-post where 2017, 02 and 09 are autocreated and empty. or redirect to the parent or whatever. maybe check what things the RoutingAutoBundle supports to see use cases we currently have in the cmf itself.

if redirect routes can have route children, i think we could say this just forces to use a good route design (place redirect routes as intermediate, rather than non-routes that lead to a 404 when removing folders from the url). as the mapping can be overwritten, that sounds like a decision we can promote.

@@ -5,7 +5,7 @@
https://github.com/doctrine/phpcr-odm/raw/master/doctrine-phpcr-odm-mapping.xsd"
>

<document name="Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute">
<document name="Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute" is-leaf="true">
Copy link
Member

Choose a reason for hiding this comment

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

i disagree with this. we could have an intermediate node redirect to the default child node. as in /topics redirecting to /topics/symfony (ok, not the best example but i think there are valid use cases like this)

@wouterj
Copy link
Member Author

wouterj commented Feb 9, 2017

we could have something like /blog/2017/02/09/my-post where 2017, 02 and 09 are autocreated and empty. or redirect to the parent or whatever. maybe check what things the RoutingAutoBundle supports to see use cases we currently have in the cmf itself.

if redirect routes can have route children, i think we could say this just forces to use a good route design (place redirect routes as intermediate, rather than non-routes that lead to a 404 when removing folders from the url). as the mapping can be overwritten, that sounds like a decision we can promote.

Currently, routing auto uses the Generic document for the intermediate parts. Do we want to switch that to redirect routes? (and with what behaviour, i.e. redirect to the first non-redirect parent node?) /cc @dantleech

Or we should skip this for the RoutingBundle, think about this a little more and add this in CMF 3.0.

@wouterj
Copy link
Member Author

wouterj commented Feb 10, 2017

Closing as we are not sure how to apply this to routes.

@wouterj wouterj closed this Feb 10, 2017
@wouterj wouterj deleted the issue-386/child-restrictions branch February 10, 2017 14:27
@wouterj wouterj removed the wip/poc label Feb 10, 2017
@wouterj wouterj removed this from the 2.0 milestone Feb 10, 2017
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.

Configure PHPCR ODM child restrictions
2 participants