Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-03-2008, 08:30 PM
Junior Member
 
Join Date: Mar 2008
Posts: 1
Default classes within modules

hi all

i'm sure theres an easy answer to this but i'm stumped!

I've setup my site to use modules as set out on the ZF documentation:

Code:
docroot/
    index.php
application/
    default/
        controllers/
            IndexController.php
            FooController.php
        models/
        views/
            scripts/
                index/
                foo/
            helpers/
            filters/
    blog/
        controllers/
            IndexController.php
        models/
        views/
            scripts/
                index/
            helpers/
            filters/
The issue I have is that I can't seem to reference any files in the respective model directories under each module. I;ve used $front->addControllerDirectory() to set the locations fine and know you need to precede action controllers with module names. I also have Zend_Loader set to autoload.

For example, under the models dir in blog module i have a class called myClass.php,I then try to call this

Code:
public function blog_IndexAction(){
 $myclass = new myClass()
}

and it fails as it can't find class 'myClass'. I've tried
Code:
public function blog_IndexAction(){
 $myclass = new blog_myClass()
}
and that doesn't work either. Am I missing something here? Do I have to manually set the model directories for each module before zend_loader recognises them?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-10-2008, 02:23 PM
Member
 
Join Date: Aug 2007
Location: Sweden
Posts: 52
Send a message via MSN to Leif.Högberg
Default

If you name your class blog_models_myclass it should work just fine.
The zend loader assumes that classes have their path in their name.
/ or \ would be replaced by _ tho.

If that doesn't help, make sure that "application/" is in your php include path.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-20-2008, 06:35 PM
Member
 
Join Date: Jun 2008
Location: Florida
Posts: 88
Default

Have you required your model classes?

Last edited by jweber : 06-20-2008 at 06:43 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:26 AM.