Unfortunately the Xml class is not able to determine the root key and the
child keys from a Model::find(). Model::find() return something like:
Array(
[0] => Array(
['ModelA'] => Array( ... )
['ModelB'] => Array( ... )
),
[1] => Array (...)
)
So, in this case, what is the root key? ModelA? ModelB? The Xml class cannot
take this decision. So, you need to define, at least, the root key (in your
case you putted array('Logs' => $findResult)). BUT, you cannot have a list
(array with numeric keys) in the root level. Otherwise you will have tags
like <0>, <1>, ... or it will try to have many root key (what is not allowed
by XML), ie: <Logs>...</Logs><Logs>...</Logs> in root level.
So, in this case, you need to have 2 levels in the array (that you used
array('Logs' => array('item' => $findResult))). It make sense and will
generate something like:
<Logs>
<item>
<ModelA> ... </ModelA>
<ModelB> ... </ModelB>
</item>
<item>
...
</item>
</Logs>
That make sense to Xml class and to xml language.
You can see these informations on
http://book.cakephp.org/2.0/en/core-utility-libraries/xml.html
Juan Basso
--
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