--- library/Zend/Db/Table/Abstract.php (revision 8510) +++ library/Zend/Db/Table/Abstract.php (working copy) @@ -531,7 +531,6 @@ { $this->_setupDatabaseAdapter(); $this->_setupTableName(); - $this->_setupMetadata(); $this->_setupPrimaryKey(); } @@ -581,6 +580,8 @@ */ protected function _setupMetadata() { + if(sizeof($this->_metadata) > 0) return true; + // Assume that metadata will be loaded from cache $isMetadataFromCache = true; @@ -632,6 +633,7 @@ */ protected function _setupPrimaryKey() { + $this->_setupMetadata(); if (!$this->_primary) { $this->_primary = array(); foreach ($this->_metadata as $col) { @@ -738,6 +740,8 @@ */ public function info($key = null) { + $this->_setupMetadata(); + $info = array( self::SCHEMA => $this->_schema, self::NAME => $this->_name, @@ -750,7 +754,7 @@ self::DEPENDENT_TABLES => $this->_dependentTables, self::SEQUENCE => $this->_sequence ); - + if ($key === null) { return $info; } @@ -859,6 +863,7 @@ */ public function _cascadeUpdate($parentTableClassname, array $oldPrimaryKey, array $newPrimaryKey) { + $this->_setupMetadata(); $rowsAffected = 0; foreach ($this->_getReferenceMapNormalized() as $map) { if ($map[self::REF_TABLE_CLASS] == $parentTableClassname && isset($map[self::ON_UPDATE])) { @@ -908,6 +913,7 @@ */ public function _cascadeDelete($parentTableClassname, array $primaryKey) { + $this->_setupMetadata(); $rowsAffected = 0; foreach ($this->_getReferenceMapNormalized() as $map) { if ($map[self::REF_TABLE_CLASS] == $parentTableClassname && isset($map[self::ON_DELETE])) { @@ -985,6 +991,7 @@ } } + $this->_setupMetadata(); $whereClause = null; if (count($whereList)) { $whereOrTerms = array();