equal
deleted
inserted
replaced
13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_Db |
16 * @package Zend_Db |
17 * @subpackage Table |
17 * @subpackage Table |
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @version $Id: Abstract.php 22229 2010-05-21 20:55:01Z ralph $ |
20 * @version $Id: Abstract.php 24831 2012-05-30 12:52:25Z rob $ |
21 */ |
21 */ |
22 |
22 |
23 /** |
23 /** |
24 * @see Zend_Db |
24 * @see Zend_Db |
25 */ |
25 */ |
27 |
27 |
28 /** |
28 /** |
29 * @category Zend |
29 * @category Zend |
30 * @package Zend_Db |
30 * @package Zend_Db |
31 * @subpackage Table |
31 * @subpackage Table |
32 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
32 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
33 * @license http://framework.zend.com/license/new-bsd New BSD License |
33 * @license http://framework.zend.com/license/new-bsd New BSD License |
34 */ |
34 */ |
35 abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess, IteratorAggregate |
35 abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess, IteratorAggregate |
36 { |
36 { |
37 |
37 |
644 |
644 |
645 public function getIterator() |
645 public function getIterator() |
646 { |
646 { |
647 return new ArrayIterator((array) $this->_data); |
647 return new ArrayIterator((array) $this->_data); |
648 } |
648 } |
649 |
649 |
650 /** |
650 /** |
651 * Returns the column/value data as an array. |
651 * Returns the column/value data as an array. |
652 * |
652 * |
653 * @return array |
653 * @return array |
654 */ |
654 */ |
720 if (count($primary) != count($array)) { |
720 if (count($primary) != count($array)) { |
721 require_once 'Zend/Db/Table/Row/Exception.php'; |
721 require_once 'Zend/Db/Table/Row/Exception.php'; |
722 throw new Zend_Db_Table_Row_Exception("The specified Table '$this->_tableClass' does not have the same primary key as the Row"); |
722 throw new Zend_Db_Table_Row_Exception("The specified Table '$this->_tableClass' does not have the same primary key as the Row"); |
723 } |
723 } |
724 return $array; |
724 return $array; |
|
725 } |
|
726 |
|
727 /** |
|
728 * Retrieves an associative array of primary keys. |
|
729 * |
|
730 * @param bool $useDirty |
|
731 * @return array |
|
732 */ |
|
733 public function getPrimaryKey($useDirty = true) |
|
734 { |
|
735 return $this->_getPrimaryKey($useDirty); |
725 } |
736 } |
726 |
737 |
727 /** |
738 /** |
728 * Constructs where statement for retrieving row(s). |
739 * Constructs where statement for retrieving row(s). |
729 * |
740 * |
1165 * @param string $tableName |
1176 * @param string $tableName |
1166 * @return Zend_Db_Table_Abstract |
1177 * @return Zend_Db_Table_Abstract |
1167 */ |
1178 */ |
1168 protected function _getTableFromString($tableName) |
1179 protected function _getTableFromString($tableName) |
1169 { |
1180 { |
1170 |
1181 return Zend_Db_Table_Abstract::getTableFromString($tableName, $this->_table); |
1171 if ($this->_table instanceof Zend_Db_Table_Abstract) { |
|
1172 $tableDefinition = $this->_table->getDefinition(); |
|
1173 |
|
1174 if ($tableDefinition !== null && $tableDefinition->hasTableConfig($tableName)) { |
|
1175 return new Zend_Db_Table($tableName, $tableDefinition); |
|
1176 } |
|
1177 } |
|
1178 |
|
1179 // assume the tableName is the class name |
|
1180 if (!class_exists($tableName)) { |
|
1181 try { |
|
1182 require_once 'Zend/Loader.php'; |
|
1183 Zend_Loader::loadClass($tableName); |
|
1184 } catch (Zend_Exception $e) { |
|
1185 require_once 'Zend/Db/Table/Row/Exception.php'; |
|
1186 throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e); |
|
1187 } |
|
1188 } |
|
1189 |
|
1190 $options = array(); |
|
1191 |
|
1192 if (($table = $this->_getTable())) { |
|
1193 $options['db'] = $table->getAdapter(); |
|
1194 } |
|
1195 |
|
1196 if (isset($tableDefinition) && $tableDefinition !== null) { |
|
1197 $options[Zend_Db_Table_Abstract::DEFINITION] = $tableDefinition; |
|
1198 } |
|
1199 |
|
1200 return new $tableName($options); |
|
1201 } |
1182 } |
1202 |
1183 |
1203 } |
1184 } |