I'm having difficulty returning a DataObjectSet result from an SQLQuery. I've been following the docu page outline and reviewing other suggestions from the forum, but I'm consistently getting errors.
My function is:
function OpenhousesSaturday()
{
$week_number = date('W');
$year = date('Y');
$day = date("Y-m-d", strtotime($year."W".$week_number."6"));
$sqlQuery = new SQLQuery();
$sqlQuery->select = array(
'`Openhouse`.*',
'`PropertyPage`.*',
);
$sqlQuery->from = array("Openhouse", "LEFT JOIN `PropertyPage` ON `Openhouse`.`PropertyPageID` = `PropertyPage`.`ID`");
$sqlQuery->where = array("'$day' = `Openhouse`.`ViewDate`");
// get the raw SQL
$rawSQL = $sqlQuery->sql();
// execute and return a Query-object
$result = $sqlQuery->execute();
//setup our blank DataObjectSet to push SQL result data into it.
$dataObject1 = new DataObjectSet();
foreach($result as $row) {
//move the SQL result data to the DataObjectSet
$dataObject1->push(new ArrayData($row));
}
return $dataObject1;
}
And I'm getting this error:
Fatal error: Call to a member function XML_val() on a non-object...
Can anyone point me in the right direction on this?
Many thanks,
Jayne