Closed dereuromark closed 6 months ago
When baking a table with enum, everything works out automatically, except for the fixture
'status' => '',
leads to
TypeError: App\Model\Enum\OfferStatus::tryFrom(): Argument #1 ($value) must be of type int, string given
It is a int backed enum, so the default should either be null or numeric
The field itself is not null (required input). I checked and it is the same issue for both default value present or default null.
Expected behavior:
Looking into bake schema collection, I can see those being passed into _generateRecords():
[ 'type' => 'enum-app-model-enum-offeraccuracy', 'length' => null, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '[enum] exact:0, approximate:1, month:2', 'precision' => null, 'autoIncrement' => null ] [ 'type' => 'enum-app-model-enum-offerstatus', 'length' => null, 'unsigned' => true, 'null' => false, 'default' => '1', 'comment' => '[enum] inactive:0, active:1, public:2', 'precision' => null, 'autoIncrement' => null ]
which looks correct, if we ignore the string vs int part on the default value.
But apparently, they are not being used.
5.x
8.2
Description
When baking a table with enum, everything works out automatically, except for the fixture
leads to
It is a int backed enum, so the default should either be null or numeric
The field itself is not null (required input). I checked and it is the same issue for both default value present or default null.
Expected behavior:
Looking into bake schema collection, I can see those being passed into _generateRecords():
which looks correct, if we ignore the string vs int part on the default value.
But apparently, they are not being used.
Bake Version
5.x
PHP Version
8.2