Revision #13 has been created by grigori on Nov 25, 2019, 11:11:46 PM with the memo:
updated sample code for fields() callback
« previous (#12) next (#14) »
Changes
Title
unchanged
UUID instead of an auto-increment integer for ID with Active Record
Category
unchanged
How-tos
Yii version
unchanged
2.0
Tags
unchanged
mysql,active record,REST,UUID
Content
changed
[...]
```php
public function fields()
{
$fields = parent::fields();
$fields['id'] =function(){return $this->getId();};
return $fields;
}
```
This method is used by RESTful serializers to format data when you access your API with `GET /video` requests.
So, now you can go the generic MySQL way[...]