ORM, TableLocator and plugins

Hello all!

I’m kind a new in CakePHP, last time I’ve used it was more than 10 years ago. Im creating a simple app with 2 plugins, lets call them:


Both of plugins are using the same database table, lets say Candies, with fields: field1, field2, field3. But - Plugin1 uses only field1 and field2. Plugin2 uses only field2 and field3.

The question is:

should I create a corresponding php model (Entity/Candy, Table/CandiesTable) in root App folder or separately in Plugin1 and Plugin2? In case of second choice, how to configure TableLocator i Plugin1Plugin.php and Plugin2Plugin.php?

You can have multiple table classes which point to the same database table - no matter if its in the base app or in a plugin.

The only important part is how you name those table classes so you can uniquely refer to them.

What you do inside those table classes is up 2 you and can be completely configured how you desire.