34k+
News
Guide
API
Wiki
Forum
Community
Places
Members
Hall of Fame
Badges
More
Learn
Books
Resources
Develop
Download Yii
Extensions
Report an Issue
Report a Security Issue
Contribute to Yii
Donate
About
Release Cycle
License
Team
Official Logos and Design
Login
UUID instead of an auto-increment integer for ID with Active Record
Comparing
#12
with
#13
Revision #13 was created by
grigori
on Nov 25, 2019, 11:11:46 PM.
updated sample code for fields() callback
« Previous (#12)
Next (#14) »
Content
[...]
```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
[...]