Li3 - Handle MySQL 5.7 Generated Columns Properly

93 views Asked by At

In MySQL you can have read-only columns that get auto-generated content based on sub-queries / actions.

For example, you can make it store the value extracted from a JSON column (using the 5.7 JSON features).

This does not work in Li3 by default when you get and then try to save a row.

It will try to set the value to null, which throws a mysql 3105 error and fail.

In the mean time, I've had to write a manual PDO query, but it would be ideal if this worked in Li3.

1

There are 1 answers

0
Nate Abele On BEST ANSWER

You can use the whitelist feature of Model::save() to restrict the fields that get written in the update.