0

I have basic zend framework installation. I create new db table models/tables/User.php

<?php 

require_once 'Zend/Db/Table/Abstract.php';

class UserTable extends Zend_Db_Table_Abstract
{
    protected $_name = 'user';
}

And later in IndexController I make a call to table:

public function indexAction()
{

        $userTable = new UserTable();
}

But I get fatal error: Fatal error: Class 'UserTable' not found. What I do wrong ?

Your help would be appreciated.

Bounce
  • 2,066
  • 6
  • 34
  • 65
  • What is the name of the file? – Nandakumar V Nov 30 '12 at 09:39
  • _What I do wrong ?_ You didn't start with the documentation. http://framework.zend.com/manual/1.12/en/learning.quickstart.intro.html would be a really good place to start. http://akrabat.com/zend-framework-tutorial/ is also really good. – RockyFord Dec 01 '12 at 06:25

1 Answers1

2

I think the issue is with the naming. In Zend the classes are autoloaded according to its name.

If the name of the file is User.php, the class name should be User
If the file is in the location Models/Usertable.php the class name should be Models_Usertable

There are several methods of autoloading techniques in ZF. Check this manual learning.autoloading.design

Nandakumar V
  • 4,317
  • 4
  • 27
  • 47