Domanda

Since 2.1.4 the Query route is deprecated, I'm routing to my blog like this:

        'cro-blog' => array(
            'type' => 'Literal',
            'options' => array(
                'route' => '/blog',
                'defaults' => array(
                    'controller' => 'CroBlog\BlogController',
                    'action'     => 'index',
                ),
            ),
        ),

And link to pages like /blog?p=x where x is the page number. This works perfectly until I add a child route. Linking to /blog still works but linking to pages give a 404 (more specific 'The requested URL could not be matched by routing.'). This is my current setup:

        'cro-blog' => array(
            'type' => 'Literal',
            'options' => array(
                'route' => '/blog',
                'defaults' => array(
                    'controller' => 'CroBlog\BlogController',
                    'action'     => 'index',
                ),
            ),
            'may_terminate' => true,
            'child_routes' => array(
                'post' => array(
                    'type' => 'Segment',
                    'options' => array(
                        'route' => '/:slug',
                        'constraints' => array(
                            'slug' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        ),
                        'defaults' => array(
                            'action' => 'post',
                        ),
                    ),
                ),
            ),
        ),

I'm using a Segment child route but the same problem exists with a Literal child route.

Any way to keep the page query and the child routes?

È stato utile?

Soluzione

This is solved. If anyone experiences the same issues, this is what worked for me.

  • Clear all cache (EdpSuperluminal, APC etc.)
  • Remove Zend library
  • Run your application without Zend library (giving loads of errors of course, but this seemed crucial to me to make it work)
  • Re-install Zend library
  • Run your application again

I installed 2.1.5dev and it fixed the issue. Wanted to make sure whether it was a bug or not so tried again with 2.1.4 and the issue was still fixed. So this is my conclusion. Cache can be a weird thing.

Edit Jumped to (the wrong) conclusions too soon. Fired up Zend Studio 10 and now it bugs again. I think Zend Studio 10 is reverting some files (not all since Query route did got marked as deprecated). Still, consider this solved, just need to find a way to tell Zend Studio 10 to use 2.1.4. Thanks!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top