tags:

views:

198

answers:

1

Hi, I have two applications in CakePHP, App A an App B. I want that App B have access to the models in App A. I found that this is possible with the $modelPaths variable in the bootstrap.php file, but I have some models with the same name in both applications. Is this a problem? If this is a problem, how can I select only some models from the App A to be used by App B? If this is not a problem, how can I know what model is from App A and what is from App B? Thanks

+2  A: 

I believe that CakePHP will load the first model it finds.

If I am correct, it will start with models in your app/models/ folder (and any subdirectories it contains), then iterate through each additional class path you defined (ie. those in $modelPaths), then finally look for models in the core (ie. cake/lib/model/).

So basically, Cake will load the model in the core, unless a model exists elsewhere. It will then load the model elsewhere, unless there is an app-specific model in your applications directory.

With some basic testing you should be able to confirm if this is the case.

deizel