views:

32

answers:

2

Hello,

I'm using Zend Framework version 1.7.8.

I am trying to create a class that extends from Zend_Db_Table_Abstract:

class My_Model_Table extends Zend_Db_Table_Abstract {    
    public function __construct($tableName) {
        parent::__construct(array('name' => $tableName, 'primary' => 'dummy', 'db' => Zend_Registry::get('dbAdapter')));
    }
}

However, when I try to fetch from this table:

$table = new My_Model_Table('dual');
Zend_Debug::dump($table->fetchAll());

I am getting this exception:

Primary key column(s) (dummy) are not columns in this table (DUMMY) 

For those of you not familiar with Oracle, the DUAL table is a standard Oracle table which has only one column: DUMMY. From what I can see in the error message, ZF is trying to fetch from the "DUMMY" table which doesn't exist. Am I right? What am I doing wrong?

Thanks!

A: 

Have you tried:

Class VCCE_Model_Table extends Zend_Db_Table_Abstract {
   protected $_name = 'DUAL';
 }

$table = new VCCE_Model_Table();
Zend_Debug::dump($table->fetchAll());

Note: in your example you use two different names for your table VCCE_Model_Table and My_Model_Table.

Iznogood
Yes, sorry, that was a mistype.If I try the way you wrote, I'm getting exception "No entry is registered for key 'dual'", thrown by Zend_Db_Table_Abstract->_setAdapter('dual')
Dario
Well as Udo said are you sure you setup your adapter right? Im sorry I neevr worked with oracle so maybe I am overlooking something. Ths should be pretty simple(fetching all from a single table in zend_db)
Iznogood
In your post you put DUAL, where dual is lower case. Have you tried with uppercase?
Ashley
I edited my answer but I doubt this will change anything
Iznogood
Thanks for the feedback, guys. Yes, I am sure that adapter is not the problem. If I run Zend_Debug::dump(Zend_Registry::get('dbAdapter')->fetchAll('SELECT * FROM dual'));, I get proper result.
Dario
Ashley, thanks for the hint! It was in fact problem that column names and table names had to be uppercase.
Dario
A: 

Did you check the configuration settings for dbAdapter?

udo