Revision #12 has been created by grigori on Nov 25, 2019, 11:10:29 PM with the memo:
added the fields() callback
« previous (#11) next (#13) »
UUID instead of an auto-increment integer for ID with Active Record
[...]Active Record does not call the getter method if attributes contain the property. It should not be this way, so I return the default component behavior and make ID returned the right way.
From the other hand, the first valiator calls `$model->id` triggering the getter before the UUID is saved to the private property so I need to serve the value from user input.
It is strange to mutate data in a validator, but I found this is the only way. I belive I shouldn't use `beforeSave()` callback to set the binary value for generating SQL, and return the text value back in `afterSave()` - supporting this code would be a classic hell like `#define true false;`.
So, now you can go the generic MySQL way
4. add a virtual column
ALTER TABLE t1 ADD id_text varchar(36) generated always as