Location of DB models in Zend Framework - want them centralized

Posted by jeffkolez on Stack Overflow See other posts from Stack Overflow or by jeffkolez
Published on 2010-06-17T12:37:05Z Indexed on 2010/06/17 14:43 UTC
Read the original article Hit count: 145

Filed under:
|

Maybe I've been staring at the problem too long and it's much simpler than I think, but I'm stuck right now.

I have three websites that are going to share database models. I've structured my applications so that I have an application directory for each site and a public directory for each site. The DB models live in a directory in the library along with Zend Framework and my third party libraries. I use the Autoloader class and when I try to instantiate one of my DB classes, it fails. The library directory is in my include path, but for whatever reason it refuses to instantiate my classes.

It will work if I have my models in my application directory, but that's not the point. They're supposed to be shared classes in a Library.

$model = new Model_Login();
$model->hello_world();

This fails when its in the library. The class is just a test:

 class Model_Login
 {
     public function hello_world()
     {
        echo "hello world";
     }
 }

Everything works until I try to instantiate one of my models. I've even tried renaming the class to something else (Db_Login), but that doesn't work either. Any ideas? Thanks in advance.

© Stack Overflow or respective owner

Related posts about php

Related posts about zend-framework