symfony-cmf / routing-auto-bundle

Adding automatic route generating on top of the symfony cmf routing
https://cmf.symfony.com
14 stars 29 forks source link

try to redirect route to 404 when object is removed #185

Closed leto3087 closed 8 years ago

leto3087 commented 8 years ago

Hi, When i remove an object (in this example, it's an Article object), the route associated isn't remove and i have this error

Unable to find the controller for path "/url-of-the-article". The route is wrongly configured.

Can you help me ?

My Config

AppBundle\Entity\Article:
    uri_schema: /{thematique}/{title}.html
    conflict_resolver: auto_increment
    defunct_route_handler: leave_redirect
    token_providers:
        thematique: [content_method, { method: getThematiqueTitre }]
        title: [content_method, { method: getTitre }]`

cmf_routing:
    chain:
        routers_by_id:
            cmf_routing.dynamic_router: 100
            router.default: 20
    dynamic:
        enabled: true
        persistence:
            orm: true
        controllers_by_type:
            cmf_routing_auto.redirect: cmf_routing_auto.redirect_controller:redirectAction
        controllers_by_class:
            Symfony\Cmf\Component\Routing\RedirectRouteInterface: cmf_routing.redirect_controller:redirectAction
            AppBundle\Entity\Article: AppBundle:Article:view
dantleech commented 8 years ago

When do you have that error?

The PHPCR-ODM listener should remove referring routes (test) (including any redirect routes) when the object (Article) is removed. If that isn't happening, then there is a bug.

leto3087 commented 8 years ago

i have this error when i remove the object Article and i try to access to his url

dantleech commented 8 years ago

ok, so you get the error when you remove the article and try and access the URL for that removed article? In this case I would expect that the route be removed and that you would indeed receieve this error when accessing the (now deleted) route.

What do you expect to happen?

leto3087 commented 8 years ago

when the object is deleted, I would like the route redirects to 404. Currently, this is not the case and I have this error. It's possible ? I may have missed something

dantleech commented 8 years ago

Can you post a stack trace on a gist? (https://gist.github.com) ?

dantleech commented 8 years ago

Did you resolve the problem?