/** * Populate object with information about the table it represents * * Call {@link * http://pear.php.net/manual/en/package.database.db.db-common.tableinfo.php * DB_common::tableInfo()} to get a description of the table and * store it in {@link $content_columns}. Add a more human * friendly name to the element for each column. * @uses $db * @uses $content_columns * @uses Inflector::humanize() * @see __set() * @param string $table_name Name of table to get information about */ function set_content_columns($table_name) { if (!is_null($this->table_prefix)) { $table_name = $this->table_prefix . $table_name; } if (isset(self::$table_info[$table_name])) { $this->content_columns = self::$table_info[$table_name]; } else { self::$db->loadModule('Reverse', null, true); $this->content_columns = self::$db->reverse->tableInfo($table_name); if ($this->is_error($this->content_columns)) { $this->raise($this->content_columns->getMessage()); } if (is_array($this->content_columns)) { $i = 0; foreach ($this->content_columns as $column) { $this->content_columns[$i++]['human_name'] = Inflector::humanize($column['name']); } self::$table_info[$table_name] = $this->content_columns; } } }