Note that there are some explanatory texts on larger screens.

plurals
  1. POXML helper/output of model data in 2.0?
    primarykey
    data
    text
    <p>My XML View files contain (for exporting records via XML):</p> <pre><code> &lt;records&gt;&lt;?php echo $this-&gt;Xml-&gt;serialize($records); ?&gt;&lt;/records&gt; </code></pre> <p>After upgrading to 2.0 I realized there is no Xml helper anymore. But the Xml class itself doesnt seem to provide an equally powerful method anymore, either. It only contains sth like</p> <pre><code>$Xml = Xml::fromArray($records, array('format' =&gt; 'attribute')); ... &lt;records&gt;&lt;?php echo $Xml-&gt;asXML(); ?&gt;&lt;/records&gt; </code></pre> <p>But that - of course - fails because it can only transform "one record at a time". It also fails if I force it into a single parent key like</p> <pre><code>$records = array('records'=&gt;$records); </code></pre> <p>first...</p> <p>No clue how to get the XML export stuff working, again. especially, as it seems, the expected input for the 2.0 XML class (http://book.cakephp.org/2.0/en/core-utility-libraries/xml.html#Xml) is quite different from what the model returns (and would probably have to be transformed somehow). Old structure (and like the model respectably):</p> <pre><code>$records = array( array('Project'=&gt;array('field'=&gt;'value', ...)), array('Project'=&gt;array('field'=&gt;'value', ...)), ); </code></pre> <p>New structure</p> <pre><code>$records = array( 'projects' =&gt; array( 'project' =&gt; array( array( 'id' =&gt; 1, 'title' =&gt; 'Project 1', 'industry' =&gt; array('id' =&gt; 1, 'name' =&gt; Industry 1') ), array( 'id' =&gt; 2, 'title' =&gt; 'Project 2', 'industry' =&gt; array('id' =&gt; 2, 'name' =&gt; Industry 2') ) ) ) ); </code></pre> <p>Totally incompatible to what the model gives us, or so it seems.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload