7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
18 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: Definition.php 16971 2009-07-22 18:05:45Z mikaelkael $
24 * Class for SQL table interface.
29 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
30 * @license http://framework.zend.com/license/new-bsd New BSD License
32 class Zend_Db_Table_Definition
38 protected $_tableConfigs = array();
43 * @param array|Zend_Config $options
45 public function __construct($options = null)
47 if ($options instanceof Zend_Config
) {
48 $this->setConfig($options);
49 } elseif (is_array($options)) {
50 $this->setOptions($options);
57 * @param Zend_Config $config
58 * @return Zend_Db_Table_Definition
60 public function setConfig(Zend_Config
$config)
62 $this->setOptions($config->toArray());
69 * @param array $options
70 * @return Zend_Db_Table_Definition
72 public function setOptions(Array $options)
74 foreach ($options as $optionName => $optionValue) {
75 $this->setTableConfig($optionName, $optionValue);
81 * @param string $tableName
82 * @param array $tableConfig
83 * @return Zend_Db_Table_Definition
85 public function setTableConfig($tableName, array $tableConfig)
88 $tableConfig[Zend_Db_Table
::DEFINITION_CONFIG_NAME
] = $tableName;
89 $tableConfig[Zend_Db_Table
::DEFINITION
] = $this;
91 if (!isset($tableConfig[Zend_Db_Table
::NAME
])) {
92 $tableConfig[Zend_Db_Table
::NAME
] = $tableName;
95 $this->_tableConfigs
[$tableName] = $tableConfig;
102 * @param string $tableName
105 public function getTableConfig($tableName)
107 return $this->_tableConfigs
[$tableName];
111 * removeTableConfig()
113 * @param string $tableName
115 public function removeTableConfig($tableName)
117 unset($this->_tableConfigs
[$tableName]);
123 * @param string $tableName
126 public function hasTableConfig($tableName)
128 return (isset($this->_tableConfigs
[$tableName]));