tech_me
tech_me

Reputation: 550

CakePHP Manipulate more than one models in the same controller

  1. I created two plugins in the CakePHP, and both of them have the same named model, e.g, plugin1.mod and plugin2.mod.
  2. In the two models, defined the same named method, e.g, mymethod.
  3. Now, I have a controller in my main program. Then, use ClassRegistry::init to initialize plugin1 and can call plugin1.mod without problem.

Problem:

When I use ClassRegistry::init to initialize plugin2 and call the plugin2.mod, it is calling plugin1.mod! Can somebody tell me what wrong here is?

Thank you.

Upvotes: 0

Views: 221

Answers (1)

mark
mark

Reputation: 21743

in 2.0 this is not possible (anymore). class paths are cached (inside App class) and therefore can use a class name only once.

You need to use different class names.

Upvotes: 1

Related Questions