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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-07-2007, 03:03 PM
Junior Member
 
Join Date: Oct 2007
Posts: 2
Exclamation Fatal error: ... describeTable() on a non-object in ... Abstract.php on line 596

Fatal error: Call to a member function describeTable() on a non-object in /raid/phplibs/zendframework/library/Zend/Db/Table/Abstract.php on line 596

Hello,

I am a newbie with ZF and using the version 1.02.

In my project I have to rewrite the insert function of the database operations. Therefore I wrote:

PHP Code:
    require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
    require_once 
'Zend/Db.php';
    require_once 
'Zend/Db/Table/Abstract.php';

class 
cDbTableOperationsLinks extends Zend_Db_Table_Abstract {
    protected 
$_name 'links'// tabellenname
    
protected $_primary 'link_id'// primär schlüssel
//    protected $_rowClass = 'MyLoggingRow';
    
   /** 
    * Eigene Logik um Zeitstempel zu managen; Zend-Insert überschreiben.
    *
    * @param array $data
    * @return unknown
    */
    
public function insert(array $data$datatype '') {
        
// Einen Zeitstempel hinzufügen
        
switch ($datatype) {
            case 
't':
                
$data['links2resources_id'] = $this->iResourceID;
                
$data['link_type'] = $datatype;
                break;
            default:
        }
        if (empty(
$data['check_time'])) {
            
$data['check_time'] = time();
        }
                
        return 
parent::insert($data);
    }

   
/**
    * Eigene Logik um Zeitstempel zu managen; Zend-Update überschreiben.
    *
    * @param array $data
    * @return unknown
    */
   
public function update(array $data$where) {
//@todo
    
        
return $this->iDbTestLinksID;
   }
    

After using
PHP Code:
  $oDbTableOperationsLinks = new cDbTableOperationsLinks();
           
$newRows $oDbTableOperationsLinks->createRow($a2Store);
           
$newRows $oDbTableOperationsLinks->save(); 
from another class the error code above is displayed. What's wrong pls?




System: Debian 4.0 and apache 2.2 including PHP 5.2.0-8+etch7
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-07-2007, 04:03 PM
Junior Member
 
Join Date: Oct 2007
Posts: 2
Thumbs up solved

It was necessary to the tell the db-adapter before class init.

(see Zend Framework: Documentation)

I took the way with
PHP Code:
           Zend_Db_Table_Abstract::setDefaultAdapter($this->oDbResoure); 
the other error is:

PHP Code:
// wrong:  $newRows = $oDbTableOperationsLinks->save(); 
//instead
 
$newRows->save(); 
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 09:46 PM.