I am using the MySql database, so I defined the column type as Tinyint (1) in the db schema.
In my ActiveRecord, I installed a logical validator. The save logic works as expected.
Now I wanted to say that when I call the Yii2 REST service, I return the boolean field as true or false instead of 1 or 0, because on the client side the structure has a strict comparison (===), and 1 is not the same as true.
Of course, I can rewrite the value manually before sending the content or on the client side before loading it into the model, but I would appreciate a cleaner solution.
source share