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:
http://localhost/authors.xml
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 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:
Post a Comment