Tuesday, May 20, 2014

Re: CakePHP 3.0-dev3 Request Routing

Ah, there you go.  A new install, so I didn't look at the Migration guide.  But I guess that's a good idea when looking for differences between 2.x and 3.x. 

I'll give it a complete read. It might fix my other issue as well.


On Wed, May 21, 2014 at 9:47 AM, euromark <dereuromark@gmail.com> wrote:
If you plan on using a dev version its always wise to take a look at the migration guide ;)
in regardings to arguments for parseExtentions()

mark


Am Mittwoch, 21. Mai 2014 01:28:12 UTC+2 schrieb Reuben:
Hi

I don't do request router a lot, but I thought I'd try something with CakePHP 3.0, and am currently working with the dev3 release.

I was under the impression that if you didnt pass any parameters to Router::parseExtensions(), then it would parse all extensions, including the basics, like xml, json and html.

However, in the sample code I was writing, the xml extension was not recognised until I had Router::parseExtensions(['xml']);

Here's snippets of the code I think is relevant:

In routes.php:

Router::mapResources('authors);
Router::parseExtensions(); // Router::parseExtensions(['xml']); "works"

in AppController.php

public $components = array('RequestHandler');

in AuthorsController.php

public function index() {
$authors = $this->paginate($this->Authors);
debug($authors);
$this->set(array(
'authors' => $authors,
'_serialize' => array('authors')
));
}

Expected URL to call:


Resulting error:

Error: Authors.xmlController could not be found.
Error: Create the class Authors.xmlController below in file: App\Controller\Authors.xmlController.php

Specifying xml in parseExtensions, "works" after a fashion (the Controller is found, but there's still an error, which is the subject of another post.

Regards
Reuben Helms

   

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to a topic in the Google Groups "CakePHP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/ZDG0GVblxT4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: