mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-12 20:49:50 +00:00
Fixes #5021, findAllThreaded does not work with tables that have set primaryKey to something other than 'id'
Removed am() from Model::_findThreaded(); Cleaned up error.php and dispatcher.test.php git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7318 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
20439c098b
commit
84069e372f
3 changed files with 12 additions and 19 deletions
|
@ -36,9 +36,7 @@ App::import('Controller', 'App');
|
|||
* @subpackage cake.cake.libs
|
||||
*/
|
||||
class CakeErrorController extends AppController {
|
||||
|
||||
var $name = 'CakeError';
|
||||
|
||||
var $uses = array();
|
||||
|
||||
function __construct() {
|
||||
|
@ -49,7 +47,6 @@ class CakeErrorController extends AppController {
|
|||
$this->Component->initialize($this);
|
||||
$this->_set(array('cacheAction' => false, 'viewPath' => 'errors'));
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Short description for file.
|
||||
|
@ -67,7 +64,6 @@ class ErrorHandler extends Object {
|
|||
* @access public
|
||||
*/
|
||||
var $controller = null;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
|
@ -78,12 +74,11 @@ class ErrorHandler extends Object {
|
|||
App::import('Core', 'Sanitize');
|
||||
|
||||
$this->controller =& new CakeErrorController();
|
||||
|
||||
$allow = array('.', '/', '_', ' ', '-', '~');
|
||||
|
||||
if (substr(PHP_OS, 0, 3) == "WIN") {
|
||||
$allow = array_merge($allow, array('\\', ':'));
|
||||
}
|
||||
|
||||
$messages = Sanitize::paranoid($messages, $allow);
|
||||
|
||||
if (!isset($messages[0])) {
|
||||
|
@ -284,10 +279,10 @@ class ErrorHandler extends Object {
|
|||
*/
|
||||
function missingHelperFile($params) {
|
||||
extract($params, EXTR_OVERWRITE);
|
||||
|
||||
|
||||
$index = array_search($helper, $this->controller->helpers);
|
||||
unset($this->controller->helpers[$index]);
|
||||
|
||||
|
||||
$this->controller->set(array(
|
||||
'helperClass' => Inflector::camelize($helper) . "Helper",
|
||||
'file' => $file,
|
||||
|
@ -303,10 +298,10 @@ class ErrorHandler extends Object {
|
|||
*/
|
||||
function missingHelperClass($params) {
|
||||
extract($params, EXTR_OVERWRITE);
|
||||
|
||||
|
||||
$index = array_search($helper, $this->controller->helpers);
|
||||
unset($this->controller->helpers[$index]);
|
||||
|
||||
|
||||
$this->controller->set(array(
|
||||
'helperClass' => Inflector::camelize($helper) . "Helper",
|
||||
'file' => $file,
|
||||
|
@ -374,5 +369,4 @@ class ErrorHandler extends Object {
|
|||
echo $this->controller->output;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1991,12 +1991,12 @@ class Model extends Overloadable {
|
|||
$return = $idMap = array();
|
||||
foreach ($results as $result) {
|
||||
$result['children'] = array();
|
||||
$id = $result[$this->alias]['id'];
|
||||
$id = $result[$this->alias][$this->primaryKey];
|
||||
$parentId = $result[$this->alias]['parent_id'];
|
||||
if (isset($idMap[$id]['children'])) {
|
||||
$idMap[$id] = am($result, $idMap[$id]);
|
||||
$idMap[$id] = array_merge($result, (array)$idMap[$id]);
|
||||
} else {
|
||||
$idMap[$id] = am($result, array('children' => array()));
|
||||
$idMap[$id] = array_merge($result, array('children' => array()));
|
||||
}
|
||||
if ($parentId) {
|
||||
$idMap[$parentId]['children'][] =& $idMap[$id];
|
||||
|
|
|
@ -562,17 +562,16 @@ class DispatcherTest extends UnitTestCase {
|
|||
$Dispatcher =& new Dispatcher();
|
||||
$uri = 'posts/home/?coffee=life&sleep=sissies';
|
||||
$result = $Dispatcher->parseParams($uri);
|
||||
$this->assertPattern('/posts/',$result['controller']);
|
||||
$this->assertPattern('/home/',$result['action']);
|
||||
$this->assertPattern('/posts/', $result['controller']);
|
||||
$this->assertPattern('/home/', $result['action']);
|
||||
$this->assertTrue(isset($result['url']['sleep']));
|
||||
$this->assertTrue(isset($result['url']['coffee']));
|
||||
|
||||
|
||||
$Dispatcher =& new Dispatcher();
|
||||
$uri = '/?coffee=life&sleep=sissy';
|
||||
$result = $Dispatcher->parseParams($uri);
|
||||
$this->assertPattern('/pages/',$result['controller']);
|
||||
$this->assertPattern('/display/',$result['action']);
|
||||
$this->assertPattern('/pages/', $result['controller']);
|
||||
$this->assertPattern('/display/', $result['action']);
|
||||
$this->assertTrue(isset($result['url']['sleep']));
|
||||
$this->assertTrue(isset($result['url']['coffee']));
|
||||
$this->assertEqual($result['url']['coffee'], 'life');
|
||||
|
|
Loading…
Add table
Reference in a new issue