php - Loading second app into its own namespace - which database will it use? -


as subject says, really.

assume have 2 apps, namespaced app_a , app_b. app_a has app_b imported git submodule , autoloaded via composer.json.

when call app_b\somemodel->somemethod() from app_a controller, model query database configured in app_b's config files, or inherit config values app_a?

short answer: won't inherit app_b's config files.

expanded answer: app_a loaded it's config files. call app_b\somemodel::somemethod() app_a, app_a's configuration used. have 2 independent applications 'knowledge' of each others state need define communication method between 2 such message queues(mq), http, sockets, streams etc etc. never import app_b submodule of app_a , vice versa unless you're ok app_*'s classes being used in context of loaded application stack.

another option @ hmvc or heirarchical mvc pattern. possibly give solution problem without keeping applications separate. there bundle in laravel 3 enabling hmvc haven't looked since (imo) anti-pattern. don't know if 1 exists laravel 4 or 5.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -

Why does a .NET 4.0 program produce a system.unauthorizedAccess error on a Windows Server 2012 machine with .NET 4.5 installed? -