Hi all,
I am trying to activate the REST functionality in CakePHP 2.0 for one
of my models called "Employee". In my controller, I have:
function index(){
$this->set('employees', $this->paginate('Employee'));
}
In my view for the XML (/app/View/Employees/xml/index.ctp), I have:
<employees>
<?php
$xml = Xml::build($employees);
echo $xml->saveXML();
?>
</employees>
I keep getting an "Invalid input. Error: An Internal Error Has
Occurred." message. I looked through the code a bit and found that
the Xml class appears to be expected an array with 1 and only one
element and an alphanumeric key. This makes me think that the example
in the book (http://book.cakephp.org/2.0/en/development/rest.html?
highlight=rest), which describes passing the result of $this->Recipe-
>find('all') to Xml::build(), is wrong because $this->Recipe-
>find('all') will return an array with numeric indices and multiple
elements.
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php