PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Retrieving Table Metadata Information

The Zend_Db_Table_Abstract class provides some information about its metadata. The info() method returns an array structure with information about the table, its columns and primary key, and other metadata.

Example 294. Example of getting the table name

<?php
$table 
= new Bugs();

$info $table->info();

echo 
"The table name is " $info['name'] . "\n";

The keys of the array returned by the info() method are described below:

  • name => the name of the table.

  • cols => an array, naming the columns of the table.

  • primary => an array, naming the columns in the primary key.

  • metadata => an associative array, mapping column names to information about the columns. This is the information returned by the describeTable() method.

  • rowClass => the name of the concrete class used for Row objects returned by methods of this table instance. This defaults to Zend_Db_Table_Row.

  • rowsetClass => the name of the concrete class used for Rowset objects returned by methods of this table instance. This defaults to Zend_Db_Table_Rowset.

  • referenceMap => an associative array, with information about references from this table to any parent tables. See this chapter.

  • dependentTables => an array of class names of tables that reference this table. See this chapter.

  • schema => the name of the schema (or database or tablespace) for this table.

Zend Framework