Skip to content

Commit a7ca292

Browse files
committed
implemented enum value type check
1 parent b34aab6 commit a7ca292

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/DataModelGenerator/DataModelGenerator.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,14 @@ protected function generateBaseEntities(): void
303303
]);
304304

305305
foreach ($entity->getFields() as $field) {
306+
$fieldValue = $field->getValue();
307+
308+
if (!\is_numeric($fieldValue)) {
309+
throw new \RuntimeException("The value `$fieldValue` is currently not supported as constant value!");
310+
}
311+
306312
// TODO: also support strings, etc.
307-
$property = new EntityClassProperty($field->getName(), 'int', $field->getValue(), []);
313+
$property = new EntityClassProperty($field->getName(), 'int', $fieldValue, []);
308314

309315
$property->setConstant(true);
310316

0 commit comments

Comments
 (0)