I'm trying to populate a DataObjectSet and then display the values in a template, but I'm running out of sanity.
the code below looks to me just like the code in tutorial 3 where I'm pushing ArrayData into the doSet, but I always end up with a getViewer User error.
If I try returning $doSet->toArray(); then my <% if %> template is shown but without any values, or the ID displayed is the Page ID or the control loop doesn't show.
function ProcessDoSet(){
$doSet = new DataObjectSet();
if(Director::URLParam('Action') == "ProcessDoSet"){
$ID = Convert::raw2xml(Director::URLParam('ID'));
if(is_numeric($ID )){
$record = array('Action' => 'stations', 'ApplicationID' => $ID);
$doSet->push(new ArrayData($record));
$record = array('Action' => 'Anotherstation', 'ApplicationID' => '7');
$doSet->push(new ArrayData($record));
}
return $doSet;
}
}
<% if ProcessDoSet %>
<p>Processing DoSet Params</p>
<% control ProcessDoSet %>
<p>Action is $Action</p>
<p>ApplicationID is $ApplicationID</p>
<p>ID is $ID</p>
<% end_control %>
<% end_if %>
Another thing I've noticed is that the ProcessDoSet function gets run twice (if I put an echo where I'm setting $record) which doesn't sound right.
thanks