[TOOLS] Fix bin/generate_entity_fields

This commit is contained in:
Hugo Sales 2020-08-13 01:23:55 +00:00 committed by Hugo Sales
parent 0508886fc4
commit a60c79c35d

View File

@ -1,5 +1,4 @@
#!/usr/local/bin/php #!/usr/local/bin/php
<?php <?php
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
@ -55,7 +54,7 @@ foreach ($files as $file) {
$method_name = str_replace(' ', '', ucwords(str_replace('_', ' ', $field))); $method_name = str_replace(' ', '', ucwords(str_replace('_', ' ', $field)));
$default = @$schema['fields'][$field]['default']; $default = @$schema['fields'][$field]['default'];
if (isset($default) && $nullable != '?' && $type != '\DateTimeInterface') { if (isset($default) && $nullable != '?' && $type != 'DateTimeInterface') {
if (is_string($default)) { if (is_string($default)) {
$default = "'{$default}'"; $default = "'{$default}'";
} elseif ($type == 'bool') { } elseif ($type == 'bool') {