I am unable to use a custom SQL query to when using
$scheduler->configure();
Model class Requests extends CActiveRecord
{
public $StartDateTime;
public $EndDateTime;
...
}
Controller [code]
public function actionCalendar() {
$this->render(‘index’);
}
public function actionCalendar_data() {
$sql = “select id,abstract, DATE_FORMAT(TIMESTAMP(s__date, tst), ‘%Y-%m-%d %H:%i’) as StartDateTime, DATE_FORMAT(TIMESTAMP(e__date, tet), ‘%Y-%m-%d %H:%i’) as EndDateTime FROM requests WHERE requestor_hrid=123456 ORDER BY StartDateTime ASC”;
$data = Requests::model()->findAllBySql( $sql );
$calendar = new SchedulerConnector( $data, "PHPYii");
$calendar->configure("requests", "id", "StartDateTime, EndDateTime, abstract");
$calendar->render();
}
[/code]
When I execute the URL+index.php?r=calendar/calendar_data I get:
<data>
<event id="5389">
<start_date></start_date>
<end_date></end_date>
<text>Security Hardening to be performed DNS</text>
</event>
If I use
$calendar->configure("requests", "id", "s__date,e__date,abstract");
I get the date value from the table column.
When I print out $calendar object, I get the following showing that the variables are being populated.[code]
[encoding:protected] => utf-8
[editing:protected] =>
[model] =>
[updating:private] =>
[db:private] => Array
(
[0] => Requests Object
(
[StartDateTime] => 2007-12-20 08:00
[EndDateTime] => 2007-12-20 04:00
[_md:private] => CActiveRecordMetaData Object
(
[tableSchema] => CMysqlTableSchema Object
(
[schemaName] =>
[name] => requests
[rawName] => requests
[primaryKey] => id
[sequenceName] =>
[foreignKeys] => Array
(
)
[columns] => Array
(
[id] => CMysqlColumnSchema Object
(
[name] => id
[rawName] => `id`
[allowNull] =>
[dbType] => int(10) unsigned
[type] => string
[defaultValue] =>
[size] => 10
[precision] => 10
[scale] =>
[isPrimaryKey] => 1
[isForeignKey] =>
[autoIncrement] => 1
[_e:private] =>
[_m:private] =>
)
…[/code]
---- QUESTION ----
How do I use the designation StartDateTime AND EndDateTime from the SQL query in the $calendar->configure()?