Difference between #12 and #13 of
UUID instead of an auto-increment integer for ID with Active Record

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
[...]
4 0
3 followers
Viewed: 21 945 times
Version: 2.0
Category: How-tos
Written by: grigori
Last updated by: samdark
Created on: Nov 25, 2019
Last updated: 7 months ago
Update Article

Revisions

View all history