+ Reply to Thread
Results 1 to 6 of 6

Thread: Canīt load models

  1. #1
    cardcc is offline Junior Member
    Join Date
    May 2009
    Posts
    2

    Default Canīt load models

    Hi there,

    I'm trying to follow the tutorial in Akra’s DevNotes Tutorial: Getting Started with Zend Framework 1.8 but with little sucess!

    When I get to part that I need to add the code:

    public function indexAction()
    {
    $this->view->title = "My Albums";
    $this->view->headTitle($this->view->title, 'PREPEND');
    $albums = new Model_DbTable_Albums();
    $this->view->albums = $albums->fetchAll();
    }

    In the IndexController I always get this error:



    I think the warnings are related to the //in the path
    /home/cardcc/public_html/zendframework/zend3/application/models/DbTable//Albums.php

    after the warnings obviously comes the Fatal error due to the fact that i couldn't load the model.

    So how do i solve this? Please help this newbie!

  2. #2
    alokin is offline Senior Member
    Join Date
    Apr 2009
    Posts
    192

    Default

    Yout model file should be named exactly as its class name, i.e.: class Albums => Albums.php. You should also set models directory in your include path...

  3. #3
    cardcc is offline Junior Member
    Join Date
    May 2009
    Posts
    2

    Default

    Quote Originally Posted by alokin View Post
    Yout model file should be named exactly as its class name, i.e.: class Albums => Albums.php. You should also set models directory in your include path...
    Could you be more specific?

    I'm just following the tutorial, why should I change any name??
    The only thing i had to change would be the database details...

    How can I set the models directory and in which file? I could show my files but they are exactly like the ones in the tutorial...

  4. #4
    Tekerson is offline Senior Member
    Join Date
    Jul 2008
    Posts
    288

    Default

    There shouldn't be any need to rename the class/file as suggested - the resource autoloader should find it, your configuration looks good as far as I can see (I haven't read that tutorial).

    Does the file /home/cardcc/public_html/zendframework/zend3/application/models/DbTable/Albums.php exist?

    I just checked a working app I have and it also causes the double slash // in the resource autoloader but it doesn't prevent anything from loading (on a linux box). So it does seem like a bug, but doesn't seem to matter. (You could check this on your platform by adding a // to any include/require you know works otherwise).
    Brenton Alker
    PHP Developer - Brisbane, Australia

    blog.tekerson.com | twitter.com/tekerson | brenton.mp

  5. #5
    umair862 is offline Junior Member
    Join Date
    May 2009
    Posts
    11

    Lightbulb Following same tutorial

    Hi,
    I am following the same tutorial as you. and i am facing problem in setting up actions in IndexController.php.
    Please read my post at
    CLI php.exe not found
    and give me any solution.
    Regards,
    Umair

  6. #6
    myos is offline Junior Member
    Join Date
    Mar 2009
    Location
    china beijing
    Posts
    3

    Smile

    hi I have the same problem, I can't find it answer, Do you ravel out it? please tell me , thank you.

+ Reply to Thread

Similar Threads

  1. Not able to load my models.
    By darrenl in forum Installation & Configuration
    Replies: 2
    Last Post: 08-27-2010, 06:17 AM
  2. Cannot Load Class
    By socceroos in forum General Q&A on Zend Framework
    Replies: 4
    Last Post: 07-26-2010, 11:41 PM
  3. Replies: 0
    Last Post: 03-21-2010, 11:24 AM
  4. Load models incorrect
    By mm.sour in forum Model-View-Controller (MVC)
    Replies: 0
    Last Post: 02-11-2010, 09:29 AM
  5. Zend not auto load the models and forms Folders and classes
    By Excel in forum Model-View-Controller (MVC)
    Replies: 7
    Last Post: 12-07-2009, 06:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts