Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-20-2007, 11:54 AM
Junior Member
 
Join Date: Sep 2007
Posts: 3
Question Table abstract layer

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-20-2007, 04:48 PM
Junior Member
 
Join Date: Sep 2007
Posts: 3
Exclamation

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-01-2007, 11:07 PM
Junior Member
 
Join Date: Oct 2007
Posts: 5
Default

do you need to override the describeTable method or something? It seems like the object or method isn't getting instantiated...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:21 PM.