00001 <?php
00032 class Zend_Db_Table_Definition
00033 {
00034
00038 protected $_tableConfigs = array();
00039
00045 public function __construct($options = null)
00046 {
00047 if ($options instanceof Zend_Config) {
00048 $this->setConfig($options);
00049 } elseif (is_array($options)) {
00050 $this->setOptions($options);
00051 }
00052 }
00053
00060 public function setConfig(Zend_Config $config)
00061 {
00062 $this->setOptions($config->toArray());
00063 return $this;
00064 }
00065
00072 public function setOptions(Array $options)
00073 {
00074 foreach ($options as $optionName => $optionValue) {
00075 $this->setTableConfig($optionName, $optionValue);
00076 }
00077 return $this;
00078 }
00079
00085 public function setTableConfig($tableName, array $tableConfig)
00086 {
00087
00088 $tableConfig[Zend_Db_Table::DEFINITION_CONFIG_NAME] = $tableName;
00089 $tableConfig[Zend_Db_Table::DEFINITION] = $this;
00090
00091 if (!isset($tableConfig[Zend_Db_Table::NAME])) {
00092 $tableConfig[Zend_Db_Table::NAME] = $tableName;
00093 }
00094
00095 $this->_tableConfigs[$tableName] = $tableConfig;
00096 return $this;
00097 }
00098
00105 public function getTableConfig($tableName)
00106 {
00107 return $this->_tableConfigs[$tableName];
00108 }
00109
00115 public function removeTableConfig($tableName)
00116 {
00117 unset($this->_tableConfigs[$tableName]);
00118 }
00119
00126 public function hasTableConfig($tableName)
00127 {
00128 return (isset($this->_tableConfigs[$tableName]));
00129 }
00130
00131 }