|
|||
|
Hello,
I am trying to create a abstract table class. I been looking the Zend documentation and the following code should work. <?php require_once('Zend/Loader.php'); require_once('Zend/Db/Table/Abstract.php'); class datacash_rev extends Zend_Db_Table_Abstract { protected $_schema = 'datacash_rev_db'; protected $_name = 'datacash_rev'; } ?> However, I get the following error :- Fatal error: Call to a member function describeTable() on a non-object in /path to framework/ZendFramework-1.0.1/library/Zend/Db/Table/Abstract.php on line 595 I have found the below thread on the Zend forum. So, I added the following code :- Zend.com Forums: PHP => Zend_Db_Table_Abstract error <?php require_once('Zend/Loader.php'); require_once('Zend/Db/Table/Abstract.php'); class datacash_rev extends Zend_Db_Table_Abstract { function __construct() { parent::__construct(); } protected $_schema = 'datacash_rev_db'; protected $_name = 'datacash_rev'; } ?> I am still getting the same error. Can someone let me know what I am doing wrong. Many Thanks ![]() |
|
|||
|
After, looking at the documentation a number of times. I have managed to get a little further with this problem. But, still can not select or insert to abstract class.
My revised code looks like :- Code to create an instance :- $db = Zend_Db::factory('PDO_MYSQL', $params); Zend_Db_Table_Abstract::setDefaultAdapter($db); $tableTestTable = new TestTable(); var_dump($tableDatacash_rev->info()); Abstract class :- <?php require_once('Zend/Loader.php'); require_once('Zend/Db/Table/Abstract.php'); class TestTable extends Zend_Db_Table_Abstract { protected $_schema = 'TestTable_db'; protected $_name = 'TestTable'; } ?> The info method returns a table with no columns, prmary key etc. Although, the table exists in database and got permission to read from web server. Can anybody point out my mistake when using the abstract class. As, its starting to drive me mad now ![]() Many Thanks Barry ![]() |
![]() |
| Thread Tools | |
| Display Modes | |
|
|