[TOOLS] Add support for updating autocode in modules

This commit is contained in:
Hugo Sales 2020-09-07 23:47:50 +00:00 committed by Hugo Sales
parent cc758f6a8e
commit 6a2a0d4e66
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -22,10 +22,9 @@ const types = [
'phone_number' => 'PhoneNumber', 'phone_number' => 'PhoneNumber',
]; ];
$path = Yaml::parseFile(ROOT . '/config/services.yaml')['services']['app.core.schemadef_driver']['arguments'][0]; $files = array_merge(glob(ROOT . '/src/Entity/*.php'),
$path = str_replace('%kernel.project_dir%', ROOT, $path); array_merge(glob(ROOT . '/components/*/Entity/*.php'),
glob(ROOT . '/plugins/*/Entity/*.php')));
$files = glob($path . '/*.php');
$classes = []; $classes = [];
@ -35,7 +34,7 @@ foreach ($files as $file) {
$declared = get_declared_classes(); $declared = get_declared_classes();
foreach ($declared as $dc) { foreach ($declared as $dc) {
if (preg_match('/App\\\\Entity/', $dc) && !in_array($dc, $classes)) { if (preg_match('/(App|(Component|Plugin)\\\\[^\\\\]+)\\\\Entity/', $dc) && !in_array($dc, $classes)) {
$class = $dc; $class = $dc;
$classes[] = $class; $classes[] = $class;
break; break;