Author: phpnut
Date: 10:10:22 PM, Friday, October 28, 2005
Message:
Fixed errors found in the sessions class
Removed code in Model::findAll that was no longer needed




git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1263 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2005-10-29 03:13:36 +00:00
parent e8ffff84da
commit 3985213812
4 changed files with 27 additions and 38 deletions

View file

@ -6,4 +6,4 @@
// +---------------------------------------------------------------------------------------------------+ // // +---------------------------------------------------------------------------------------------------+ //
/////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////
0.10.2.1260_alpha 0.10.2.1263_alpha

View file

@ -39,7 +39,7 @@
* @since CakePHP v 0.10.0.1232 * @since CakePHP v 0.10.0.1232
* *
*/ */
class Session extends Object class SessionComponent extends Object
{ {
/** /**
@ -54,7 +54,7 @@ class Session extends Object
/** /**
* Enter description here... * Enter description here...
* *
* Use like this. $this->session->write('Controller.sessKey', 'session value'); * Use like this. $this->Session->write('Controller.sessKey', 'session value');
* *
* @param unknown_type $name * @param unknown_type $name
* @param unknown_type $value * @param unknown_type $value
@ -68,7 +68,7 @@ class Session extends Object
/** /**
* Enter description here... * Enter description here...
* *
* Use like this. $this->session->read('Controller.sessKey'); * Use like this. $this->Session->read('Controller.sessKey');
* *
* @param unknown_type $name * @param unknown_type $name
* @return unknown * @return unknown
@ -81,7 +81,7 @@ class Session extends Object
/** /**
* Enter description here... * Enter description here...
* *
* Use like this. $this->session->del('Controller.sessKey'); * Use like this. $this->Session->del('Controller.sessKey');
* *
* @param unknown_type $name * @param unknown_type $name
* @return unknown * @return unknown
@ -94,7 +94,7 @@ class Session extends Object
/** /**
* Enter description here... * Enter description here...
* *
* Use like this. $this->session->check('Controller.sessKey'); * Use like this. $this->Session->check('Controller.sessKey');
* *
* @param unknown_type $name * @param unknown_type $name
* @return unknown * @return unknown
@ -107,6 +107,8 @@ class Session extends Object
/** /**
* Enter description here... * Enter description here...
* *
* Use like this. $this->Session->error();
*
* @return unknown * @return unknown
*/ */
function error() function error()
@ -117,6 +119,8 @@ class Session extends Object
/** /**
* Enter description here... * Enter description here...
* *
* Use like this. $this->Session->valid();
*
* @param unknown_type $name * @param unknown_type $name
* @return unknown * @return unknown
*/ */

View file

@ -1111,28 +1111,7 @@ class Model extends Object
$data = $newValue; $data = $newValue;
} }
} }
return $data;
foreach ($data as $key => $value)
{
foreach ($this->tableToModel as $key1 => $value1)
{
if (isset($data[$key][Inflector::singularize($key1)]))
{
$newData[$key][$value1] = $data[$key][Inflector::singularize($key1)];
}
}
}
if (!empty($newData))
{
$merged = array_merge_recursive($data,$newData);
return $newData;
}
else
{
return $data;
}
} }
/** /**

View file

@ -156,13 +156,14 @@ class CakeSession extends Object
*/ */
function getError($errorNumber) function getError($errorNumber)
{ {
if(!is_array($this->error) || !array_key_exists($errorNumber, $this->error)) $cakeSession =& CakeSession::getInstance();
if(!is_array($cakeSession->error) || !array_key_exists($errorNumber, $cakeSession->error))
{ {
return false; return false;
} }
else else
{ {
return $this->error[$errorNumber]; return $cakeSession->error[$errorNumber];
} }
} }
@ -173,9 +174,10 @@ class CakeSession extends Object
*/ */
function getLastError() function getLastError()
{ {
if($this->lastError) $cakeSession =& CakeSession::getInstance();
if($cakeSession->lastError)
{ {
return $this->getError($this->lastError); return $cakeSession->getError($cakeSession->lastError);
} }
else else
{ {
@ -190,7 +192,8 @@ class CakeSession extends Object
*/ */
function isValid() function isValid()
{ {
return $this->valid; $cakeSession =& CakeSession::getInstance();
return $cakeSession->valid;
} }
/** /**
@ -207,7 +210,7 @@ class CakeSession extends Object
$result = eval("return ".$cakeSession->_sessionVarNames($name).";"); $result = eval("return ".$cakeSession->_sessionVarNames($name).";");
return $result; return $result;
} }
$this->_setError(2, "$name doesn't exist"); $cakeSession->_setError(2, "$name doesn't exist");
return false; return false;
} }
@ -474,6 +477,7 @@ class CakeSession extends Object
*/ */
function _sessionVarNames($name) function _sessionVarNames($name)
{ {
$cakeSession =& CakeSession::getInstance();
if(is_string($name)) if(is_string($name))
{ {
if(strpos($name, ".")) if(strpos($name, "."))
@ -492,6 +496,7 @@ class CakeSession extends Object
} }
return $expression; return $expression;
} }
$cakeSession->setError(3, "$name is not a string");
return false; return false;
} }
@ -504,13 +509,14 @@ class CakeSession extends Object
*/ */
function _setError($errorNumber, $errorMessage) function _setError($errorNumber, $errorMessage)
{ {
if($this->error === false) $cakeSession =& CakeSession::getInstance();
if($cakeSession->error === false)
{ {
$this->error = array(); $cakeSession->error = array();
} }
$this->error[$errorNumber] = $errorMessage; $cakeSession->error[$errorNumber] = $errorMessage;
$this->lastError = $errorNumber; $cakeSession->lastError = $errorNumber;
} }
/** /**