Reputation: 4103
I want to know where is the best place to put the model classes inside a Zend Framework project. I heard that inside the library is the better place with versions < 1.8. And with version 1.8 we have the ResourceLoader so we can put inside the modules dir.
What's your method? What's the best practice?
Upvotes: 2
Views: 410
Reputation: 421
Using 1.11.5 currently and I'm keeping my Models in the application/models
directory.
I believe that Zend/Loader.php
has been deprecated.
Upvotes: 0
Reputation: 12939
Check out this document outilinig several typical directory layouts: Choosing Your Application's Directory Layout
My setup looks like this:
app/
controllers/
forms/
lib/
models/
views/
config.ini
lib/
sql/
var/
web/
css/
img/
js/
.htaccess
index.php
I use Zend Autoloader to automatically include model classes. The very top of my index.php
file is:
$paths = array(
'/usr/share/php/ZendFramework/library',
'../app/models',
'../app/lib',
'../app/forms',
'../app/models',
'../lib',
get_include_path()
);
set_include_path(implode(PATH_SEPARATOR, $paths));
// bootstrap
require 'Zend/Loader.php';
Zend_Loader::registerAutoload();
Works well with Zend Framework 1.7 as well as 1.8.
Upvotes: 3