In SOAP webservices datetime vars can break your webservice when you use datetime values from an ActiveRecord model without modifying them. Yii @var datetime will be mapped to SOAP xsd:dateTime, which only accepts dates in ISO 8601 format (see books.xmlschemata.org/relaxng/ch19-77049.html and date(‘c’) php.net/date ). Active record returns datetime values as ‘Y-m-d H:i:s’ by default, which is invalid for xsd:dateTme
You can easily fix this by modifying the value in the model’s afterFind() method.
Example:
Class Object extends SomeModel // with SomeModel being an activeRecord model.
{
/**
* @var datetime dateTimeVar
* @soap
*/
public $dateTimeVar;
public function afterFind() {
if($this->dateTimeVar)
$this->dateTimeVar = date('c', strtotime($this->dateTimeVar));
}
}