Hi there,
I maybe going about this the wrong way of have the wrong end of the stick but i have an SQL query that pulls data from a table on another SilverStripe database, this is all fine and pulls the data through great. The one thing i need to do is to formate the $CalloutDate on the template to be Nice. On the website where i am pulling the data from, the code
public function getNiceDate() {
return $this->obj('CalloutDate')->Nice();
}
works fine, but that's because it is referencing the dataobject on that page, looking at the code below I believe that the SQL query creates an array which i then turn into a dataset but all the data would just be a plain string, does this seem right?
public function CantechCallouts() {
global $databaseConfig, $databaseConfigCantech;
DB::connect($databaseConfigCantech);
$sqlQuery = new SQLQuery();
$sqlQuery->select = array('CalloutDate','Location','Outcome');
$sqlQuery->from = array("Callout");
//$sqlQuery->where = "";
$sqlQuery->orderby = "CalloutDate desc";
$rawSQL = $sqlQuery->sql();
$result = $sqlQuery->execute();
$dataObject1 = new DataObjectSet();
foreach($result as $row) {
//move the SQL result data to the DataObjectSet
$dataObject1->push(new ArrayData($row));
}
DB::connect($databaseConfig);
return $dataObject1;
}
So what i want to do is use $CalloutDate.Nice in the template.
any help or pointers?
regards
Mick