开发者

Load models in Zend Framework

开发者 https://www.devze.com 2023-01-17 08:11 出处:网络
I tried to search here before creating this, but I couldn\'t find anything. I have a simple project without modules and I\'d like to load my models (which are inside application/models) without using

I tried to search here before creating this, but I couldn't find anything.

I have a simple project without modules and I'd like to load my models (which are inside application/models) without using any namespace and without usign any e开发者_运维知识库xtra loading lines.

Basically what I want to do is to have my class Projects extends Zend_Db_Table_Abstract inside my models folder and to load it in my controller using $db = new Projects();

Is there anyway to do this? Is it recommended to use Model_Projects instead?

What If I had modules?

Edit:

I tried to use this without any other implementation and I got Class 'Projects' not found


It is because the Projects class is not autoloaded. Depending on your application namespace, (for example the default namespace 'Default') you have to name your class into something like: Default_Model_Projects

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号