tags:

views:

237

answers:

1

I'm using Kohana and I have several models in the Models folder of my application. Can I organize those models into subfolders and call them in a way that Kohana can find them?

+2  A: 

You sure can with Kohana 3:

I have a file 'item.php' inside 'application/classes/model' which holds the class 'Model_Item'.

If you want to go deeper, you just have to add the directory names in the classname:

The file 'item.php' inside 'application/classes/model/super/folder' which holds the class 'Model_Super_Folder_Item'. An easy way to be able to keep you from typing the whole class-name is by extending the class with a big name:

'item.php' inside 'application/classes/model' which holds the class 'Model_Item' which extends 'Model_Super\Folder_Item'.

I'm not sure if this is possible with Kohana 2.x. I went straight to using Kohana3 and skipped 2.x (almost) completely.

Caspar

related questions