[TOOLS] Fix the generate_entities_fields script

This commit is contained in:
Hugo Sales 2020-03-30 17:16:44 +00:00 committed by Hugo Sales
parent 42321b936f
commit c583c0f266
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -12,7 +12,7 @@ const types = [
'blob' => '', 'blob' => '',
'bool' => 'bool', 'bool' => 'bool',
'char' => 'string', 'char' => 'string',
'datetime' => 'DateTime', 'datetime' => '\DateTimeInterface',
'html' => 'string', 'html' => 'string',
'int' => 'int', 'int' => 'int',
'numeric' => 'float', 'numeric' => 'float',
@ -28,9 +28,10 @@ $files = glob($path . '/*.php');
foreach ($files as $file) { foreach ($files as $file) {
require_once $file; require_once $file;
$declared = get_declared_classes();
$class = end($declared); $declared = get_declared_classes();
$class = end($declared);
$no_ns_class = preg_replace('/.*?\\\\/', '', $class); $no_ns_class = preg_replace('/.*?\\\\/', '', $class);
$schema = $class::schemaDef(); $schema = $class::schemaDef();
$fields = array_keys($schema['fields']); $fields = array_keys($schema['fields']);