DB_DataObject, table desc and toArray()

From: Date: Sun, 10 Dec 2006 02:45:44 +0000
Subject: DB_DataObject, table desc and toArray()
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26055@lists.php.net to get a copy of this message
Hi there, I've been using this to get a list of the table columns: $db = new DB_DataObject; $db->tableName('mental_patient'); $table = $db->toArray(); And I'm using the columns within to populate template variables. For example: foreach ($table as $k => $v) { $smarty->assign($k, $form->text($k, $opts[$k])); } I'm wondering if the bit above with $table = $db->toArray(); will keep that behavior in future DataObjects releases? I'd hate for about a thousand sites to break in a instant if it suddently returned something else. Should I stick to grabbing it the old-fashioned way (e.g. extend the class?)? I was using this until now (before using DB_DataObject): function describe($table) { $sql = sprintf("SHOW COLUMNS FROM %s",$this->db->escapeSimple($table)); if (DB::isError($result =& $this->db->getAll($sql,array(),DB_FETCHMODE_ASSOC)) { return PEAR::raiseError($result->getMessage()); } return $result; } Thanks -- Brian Clark

« previous php.pear.general (#26055) next »