CodeIgniter Forums
Migrations autoload namespaces - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: Migrations autoload namespaces (/thread-73769.html)



Migrations autoload namespaces - onizuka8 - 06-03-2019

Hello everyone,

I'm building a project which can include one or more plugins that are within the app\Plugins folder. Plugins can contain any CI4 entity: controllers, models, migrations etc. All the plugins' namespaces are something like 'Plugins\[plugin_name]\....'

Models, controllers etc are properly auto-loaded by composer. For the migrations I'm able to load it from one or more plugins adding the its namespace within the $psr4 variable of the autoload.php ( 'Plugins\[plugin_name]\App' => APPPATH . "Plugins\[plugin_name]\app"). 

Due to plugins are included "dynamically" I would like to now if there is a way to load all the migrations within each plugins, without have to specify each plugin's namespace, in the same way that controllers and models are properly loaded only defining the "Plugins\\" namespace within the composer.json file.

Hope my question is clear enough.

Thank you in advance.


RE: Migrations autoload namespaces - kilishan - 06-03-2019

Code:
php spark migrate:latest --all



RE: Migrations autoload namespaces - onizuka8 - 06-04-2019

Hello,

Thank you for the answer, but that command works (is what i'm using) only if the namespaces are included within the autoloader.
I opened a new thread here https://forum.codeigniter.com/thread-73772.html
You can close this