See, I think I was a bit unclear with my approach. It's a bit different.
Here's how I organized it:

The actual layout turns out as follows during the forloop:

/app
/app/modules
/app/modules/core
/app/modules/core/models <-- Added to inclusion path during the forloop
/app/modules/core/models/Core 
/app/modules/core/models/Core/User.php
/app/modules/payment
/app/modules/payment/models <-- Added to inclusion path during the forloop
/app/modules/payment/models/Payment
/app/modules/payment/models/Payment/Securepay.php

However, now I have the ability to create a new object of
Payment_Securepay(). 
   => Payment_Securepay  === Payment/Securepay.php

I did this for a couple reasons:

1.) Now I have the ability to reflect the table payment_securepay accurately
( without having to make modifications ). 
The php_inclusion path has already been set during the forloop of my
directory:

Project::register('original_include_path',      get_include_path());
                \$paths[] = BP . DS . 'app' . DS . 'modules';
                \$paths[] = BP . DS . 'lib';
                \$dir = new DirectoryIterator(Project::getRoot().DS.'modules');
                foreach(\$dir as \$file){
                if (\$file->isDot() || !\$file->isDir()) {
                                continue;
                }
---> ( HERE)                    \$paths[] = \$file->getPathname().DS.'models';
                }
                set_include_path( implode(PS, \$paths) . PS .
Project::registry('original_include_path'));

2. ) I also now can separate my models into various modules. ( obviously )

3.) My little trick was nothing more than a simple way to utilize the models
a different way.... 

For example,

Project::getModel('core/session', array('name'=>'something'))->start();

This will do...

1.) require_once 'Core/Session.php';
2.) pass array('name'=>'something')
3.) calls start method on the returning object.

For you:

The Acl/Users call should request:

/app
/app/modules
/app/modules/acl
/app/modules/acl/models <-- Added to inclusion path during the forloop
/app/modules/acl/models/Acl
/app/modules/acl/models/Acl/Users.php

which will be...

class Acl_Users extends Zend_Db_Table_Abstract


which then ofcourse,

table acl_users...


Let me know if you still are having issues.


-jk


Ghrae wrote:
> 
> I followed you up to a point.
> 
> 1) I didn't have modules in my layout.  But given the size of this project
> it makes sense so I reorganized my folder structure to use models (this
> alone may make organization much easier the more I think about it)
> 
> 2) I had to add a $paths[] = $moduleDir; so that I could access forms
> 
> 3) $row =
> Project::getModel('Acl/Users')->fetchRow($user->select()->where('user_name
> =
> ?', $form->getValue('username')));
> 
> Returns an error: Fatal error: Call to a member function fetchRow() on a
> non-object in
> C:\wamp\www\el-cel\application\modules\User\controllers\IndexController.php
> on line 126
> 
> My layout was (in part)
> - application
> - - modules
> - - - user
> - - - - models
> - - - - - acl
> - - - - - - users.php
>  
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Models-and-folder-grouping-tp19412763p19458055.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to