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.

2

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.