--- a/web/lib/Zend/Db/Table/Abstract.php Thu May 07 15:10:09 2015 +0200
+++ b/web/lib/Zend/Db/Table/Abstract.php Thu May 07 15:16:02 2015 +0200
@@ -15,9 +15,9 @@
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Abstract.php 24958 2012-06-15 13:44:04Z adamlundrigan $
+ * @version $Id$
*/
/**
@@ -41,7 +41,7 @@
* @category Zend
* @package Zend_Db
* @subpackage Table
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Db_Table_Abstract
@@ -1041,16 +1041,6 @@
$primary = (array) $this->_primary;
$pkIdentity = $primary[(int)$this->_identity];
- /**
- * If this table uses a database sequence object and the data does not
- * specify a value, then get the next ID from the sequence and add it
- * to the row. We assume that only the first column in a compound
- * primary key takes a value from a sequence.
- */
- if (is_string($this->_sequence) && !isset($data[$pkIdentity])) {
- $data[$pkIdentity] = $this->_db->nextSequenceId($this->_sequence);
- $pkSuppliedBySequence = true;
- }
/**
* If the primary key can be generated automatically, and no value was
@@ -1060,7 +1050,7 @@
* position of the data. The following values are considered empty:
* null, false, true, '', array()
*/
- if (!isset($pkSuppliedBySequence) && array_key_exists($pkIdentity, $data)) {
+ if (array_key_exists($pkIdentity, $data)) {
if ($data[$pkIdentity] === null // null
|| $data[$pkIdentity] === '' // empty string
|| is_bool($data[$pkIdentity]) // boolean
@@ -1070,6 +1060,16 @@
}
/**
+ * If this table uses a database sequence object and the data does not
+ * specify a value, then get the next ID from the sequence and add it
+ * to the row. We assume that only the first column in a compound
+ * primary key takes a value from a sequence.
+ */
+ if (is_string($this->_sequence) && !isset($data[$pkIdentity])) {
+ $data[$pkIdentity] = $this->_db->nextSequenceId($this->_sequence);
+ }
+
+ /**
* INSERT the new row.
*/
$tableSpec = ($this->_schema ? $this->_schema . '.' : '') . $this->_name;
@@ -1191,7 +1191,9 @@
*/
foreach ($depTables as $tableClass) {
$t = self::getTableFromString($tableClass, $this);
- $t->_cascadeDelete($tableClass, $row->getPrimaryKey());
+ $t->_cascadeDelete(
+ get_class($this), $row->getPrimaryKey()
+ );
}
}
}
@@ -1212,20 +1214,20 @@
{
// setup metadata
$this->_setupMetadata();
-
+
// get this class name
$thisClass = get_class($this);
if ($thisClass === 'Zend_Db_Table') {
$thisClass = $this->_definitionConfigName;
}
-
+
$rowsAffected = 0;
-
+
foreach ($this->_getReferenceMapNormalized() as $map) {
if ($map[self::REF_TABLE_CLASS] == $parentTableClassname && isset($map[self::ON_DELETE])) {
-
+
$where = array();
-
+
// CASCADE or CASCADE_RECURSE
if (in_array($map[self::ON_DELETE], array(self::CASCADE, self::CASCADE_RECURSE))) {
for ($i = 0; $i < count($map[self::COLUMNS]); ++$i) {
@@ -1237,10 +1239,10 @@
$primaryKey[$refCol], $type);
}
}
-
+
// CASCADE_RECURSE
if ($map[self::ON_DELETE] == self::CASCADE_RECURSE) {
-
+
/**
* Execute cascading deletes against dependent tables
*/
@@ -1259,7 +1261,7 @@
if (in_array($map[self::ON_DELETE], array(self::CASCADE, self::CASCADE_RECURSE))) {
$rowsAffected += $this->delete($where);
}
-
+
}
}
return $rowsAffected;
@@ -1577,6 +1579,14 @@
return $data;
}
+ /**
+ * Get table gateway object from string
+ *
+ * @param string $tableName
+ * @param Zend_Db_Table_Abstract $referenceTable
+ * @throws Zend_Db_Table_Row_Exception
+ * @return Zend_Db_Table_Abstract
+ */
public static function getTableFromString($tableName, Zend_Db_Table_Abstract $referenceTable = null)
{
if ($referenceTable instanceof Zend_Db_Table_Abstract) {
@@ -1610,5 +1620,5 @@
return new $tableName($options);
}
-
+
}