import v1.1.0_beta1 | 2009-08-21

This commit is contained in:
2019-07-17 22:16:19 +02:00
parent 2c1152f0d3
commit 8dee6b1a10
2306 changed files with 251360 additions and 23428 deletions

View File

@ -25,11 +25,6 @@
*/
require_once 'Zend/Db.php';
/**
* @see Zend_Loader
*/
require_once 'Zend/Loader.php';
/**
* @category Zend
* @package Zend_Db
@ -121,6 +116,12 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
if (isset($config['table']) && $config['table'] instanceof Zend_Db_Table_Abstract) {
$this->_table = $config['table'];
$this->_tableClass = get_class($this->_table);
} else if ($this->_tableClass !== null) {
if (!class_exists($this->_tableClass)) {
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($this->_tableClass);
}
$this->_table = new $this->_tableClass();
}
if (isset($config['data'])) {
@ -203,6 +204,28 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
$this->_modifiedFields[$columnName] = true;
}
/**
* Unset row field value
*
* @param string $columnName The column key.
* @return Zend_Db_Table_Row_Abstract
* @throws Zend_Db_Table_Row_Exception
*/
public function __unset($columnName)
{
$columnName = $this->_transformColumn($columnName);
if (!array_key_exists($columnName, $this->_data)) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("Specified column \"$columnName\" is not in the row");
}
if ($this->isConnected() && in_array($columnName, $this->_table->info('primary'))) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception("Specified column \"$columnName\" is a primary key and should not be unset");
}
unset($this->_data[$columnName]);
return $this;
}
/**
* Test existence of row field
*
@ -453,7 +476,9 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
if (is_array($primaryKey)) {
$newPrimaryKey = $primaryKey;
} else {
$newPrimaryKey = array(current((array) $this->_primary) => $primaryKey);
//ZF-6167 Use tempPrimaryKey temporary to avoid that zend encoding fails.
$tempPrimaryKey = (array) $this->_primary;
$newPrimaryKey = array(current($tempPrimaryKey) => $primaryKey);
}
/**
@ -524,11 +549,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
$pkNew = $this->_getPrimaryKey(true);
$pkOld = $this->_getPrimaryKey(false);
foreach ($depTables as $tableClass) {
try {
@Zend_Loader::loadClass($tableClass);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
if (!class_exists($tableClass)) {
try {
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($tableClass);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
}
}
$t = new $tableClass(array('db' => $db));
$t->_cascadeUpdate($this->getTableClass(), $pkOld, $pkNew);
@ -602,11 +630,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
$db = $this->_getTable()->getAdapter();
$pk = $this->_getPrimaryKey();
foreach ($depTables as $tableClass) {
try {
@Zend_Loader::loadClass($tableClass);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
if (!class_exists($tableClass)) {
try {
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($tableClass);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
}
}
$t = new $tableClass(array('db' => $db));
$t->_cascadeDelete($this->getTableClass(), $pk);
@ -855,11 +886,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
$db = $this->_getTable()->getAdapter();
if (is_string($dependentTable)) {
try {
@Zend_Loader::loadClass($dependentTable);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
if (!class_exists($dependentTable)) {
try {
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($dependentTable);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
}
}
$dependentTable = new $dependentTable(array('db' => $db));
}
@ -900,6 +934,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
*
* @param string|Zend_Db_Table_Abstract $parentTable
* @param string OPTIONAL $ruleKey
* @param Zend_Db_Table_Select OPTIONAL $select
* @return Zend_Db_Table_Row_Abstract Query result from $parentTable
* @throws Zend_Db_Table_Row_Exception If $parentTable is not a table or is not loadable.
*/
@ -908,11 +943,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
$db = $this->_getTable()->getAdapter();
if (is_string($parentTable)) {
try {
@Zend_Loader::loadClass($parentTable);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
if (!class_exists($parentTable)) {
try {
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($parentTable);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
}
}
$parentTable = new $parentTable(array('db' => $db));
}
@ -951,8 +989,9 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
/**
* @param string|Zend_Db_Table_Abstract $matchTable
* @param string|Zend_Db_Table_Abstract $intersectionTable
* @param string OPTIONAL $primaryRefRule
* @param string OPTIONAL $callerRefRule
* @param string OPTIONAL $matchRefRule
* @param Zend_Db_Table_Select OPTIONAL $select
* @return Zend_Db_Table_Rowset_Abstract Query result from $matchTable
* @throws Zend_Db_Table_Row_Exception If $matchTable or $intersectionTable is not a table class or is not loadable.
*/
@ -962,11 +1001,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
$db = $this->_getTable()->getAdapter();
if (is_string($intersectionTable)) {
try {
@Zend_Loader::loadClass($intersectionTable);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
if (!class_exists($intersectionTable)) {
try {
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($intersectionTable);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
}
}
$intersectionTable = new $intersectionTable(array('db' => $db));
}
@ -980,11 +1022,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
}
if (is_string($matchTable)) {
try {
@Zend_Loader::loadClass($matchTable);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
if (!class_exists($matchTable)) {
try {
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($matchTable);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
}
}
$matchTable = new $matchTable(array('db' => $db));
}
@ -1007,8 +1052,10 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
$interInfo = $intersectionTable->info();
$interDb = $intersectionTable->getAdapter();
$interName = $interInfo['name'];
$interSchema = isset($interInfo['schema']) ? $interInfo['schema'] : null;
$matchInfo = $matchTable->info();
$matchName = $matchInfo['name'];
$matchSchema = isset($matchInfo['schema']) ? $matchInfo['schema'] : null;
$matchMap = $this->_prepareReference($intersectionTable, $matchTable, $matchRefRule);
@ -1019,8 +1066,8 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
}
$joinCond = implode(' AND ', $joinCond);
$select->from(array('i' => $interName))
->joinInner(array('m' => $matchName), $joinCond)
$select->from(array('i' => $interName), Zend_Db_Select::SQL_WILDCARD, $interSchema)
->joinInner(array('m' => $matchName), $joinCond, Zend_Db_Select::SQL_WILDCARD, $matchSchema)
->setIntegrityCheck(false);
$callerMap = $this->_prepareReference($intersectionTable, $this->_getTable(), $callerRefRule);
@ -1046,11 +1093,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
);
$rowsetClass = $matchTable->getRowsetClass();
try {
@Zend_Loader::loadClass($rowsetClass);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
if (!class_exists($rowsetClass)) {
try {
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($rowsetClass);
} catch (Zend_Exception $e) {
require_once 'Zend/Db/Table/Row/Exception.php';
throw new Zend_Db_Table_Row_Exception($e->getMessage());
}
}
$rowset = new $rowsetClass($config);
return $rowset;