From 2407160dc547269398411c88e662dc78384f9ded Mon Sep 17 00:00:00 2001 From: phpnut Date: Fri, 20 Jan 2006 18:43:05 +0000 Subject: [PATCH] Merging fixes and enhancements into trunk Revision: [1848] Fixing references. Revision: [1847] Adding fix for errors when using scaffold. On some version of PHP 4 some people where getting Call to member function on non-object... in Controller::generateFieldNames() at line 494. Fixed call to get_class_methods that was using the name of the class and not the instance of the class, this would cause a Wrong datatype for second argument... git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1849 3807eeeb-6ff5-0310-8944-8be069107fe0 --- VERSION.txt | 2 +- cake/libs/controller/controller.php | 6 +++--- cake/libs/model/model_php4.php | 6 +++--- cake/libs/model/model_php5.php | 2 +- cake/libs/view/templates/scaffolds/list.thtml | 2 +- cake/libs/view/templates/scaffolds/show.thtml | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index e7a454046..5ce822e98 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -6,4 +6,4 @@ // +---------------------------------------------------------------------------------------------------+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////// -0.10.7.1846 RC 2 \ No newline at end of file +0.10.7.1849 RC 2 \ No newline at end of file diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php index 6f5d0d5f2..7d1fc9e0e 100644 --- a/cake/libs/controller/controller.php +++ b/cake/libs/controller/controller.php @@ -484,7 +484,7 @@ class Controller extends Object $modelKey = $this->modelKey; $table = $this->{$model}->table; $association = array_search($table,$this->{$model}->alias); - $objRegistryModel = ClassRegistry::getObject($modelKey); + $objRegistryModel =& ClassRegistry::getObject($modelKey); foreach ($objRegistryModel->_tableInfo as $tables) { @@ -548,7 +548,7 @@ class Controller extends Object { $fieldNames[ $tabl['name']]['type'] = 'select'; $fieldNames[ $tabl['name']]['options'] = array(); - $otherModel = ClassRegistry::getObject(Inflector::underscore($fieldNames[$tabl['name']]['modelKey'])); + $otherModel =& ClassRegistry::getObject(Inflector::underscore($fieldNames[$tabl['name']]['modelKey'])); if (is_object($otherModel)) { if ($doCreateOptions) @@ -600,7 +600,7 @@ class Controller extends Object { $fieldNames[ $tabl['name']]['type'] = 'select'; $fieldNames[ $tabl['name']]['options'] = array(); - $otherModel = ClassRegistry::getObject(Inflector::underscore($fieldNames[$tabl['name']]['modelKey'])); + $otherModel =& ClassRegistry::getObject(Inflector::underscore($fieldNames[$tabl['name']]['modelKey'])); if( is_object($otherModel) ) { if( $doCreateOptions ) diff --git a/cake/libs/model/model_php4.php b/cake/libs/model/model_php4.php index 6c25c74ef..8c84e4308 100644 --- a/cake/libs/model/model_php4.php +++ b/cake/libs/model/model_php4.php @@ -323,7 +323,7 @@ class Model extends Object } } - if (in_array('settableprefix', get_class_methods($this->name))) + if (in_array('settableprefix', get_class_methods($this))) { $this->setTablePrefix(); } @@ -429,11 +429,11 @@ class Model extends Object $colKey = Inflector::underscore($className); if(ClassRegistry::isKeySet($colKey)) { - $this->{$className} = ClassRegistry::getObject($colKey); + $this->{$className} =& ClassRegistry::getObject($colKey); } else { - $this->{$className} = new $className(); + $this->{$className} =& new $className(); } $this->alias[$assoc] = $this->{$className}->table; diff --git a/cake/libs/model/model_php5.php b/cake/libs/model/model_php5.php index 56c95b960..f9227fe7a 100644 --- a/cake/libs/model/model_php5.php +++ b/cake/libs/model/model_php5.php @@ -323,7 +323,7 @@ class Model extends Object } } - if (in_array('settableprefix', get_class_methods($this->name))) + if (in_array('settableprefix', get_class_methods($this))) { $this->setTablePrefix(); } diff --git a/cake/libs/view/templates/scaffolds/list.thtml b/cake/libs/view/templates/scaffolds/list.thtml index ca6e415ec..b55d90051 100644 --- a/cake/libs/view/templates/scaffolds/list.thtml +++ b/cake/libs/view/templates/scaffolds/list.thtml @@ -62,7 +62,7 @@ // this is a foreign key, figure out what the display field should be for this model. $otherModelKey = Inflector::underscore($value['modelKey']); $otherControllerName = $value['controller']; - $otherModelObject = ClassRegistry::getObject( $otherModelKey ); + $otherModelObject =& ClassRegistry::getObject( $otherModelKey ); $alias = array_search($value['table'],$this->controller->{$model}->alias); if( is_object($otherModelObject) ) { diff --git a/cake/libs/view/templates/scaffolds/show.thtml b/cake/libs/view/templates/scaffolds/show.thtml index bb9564509..b81c9126f 100644 --- a/cake/libs/view/templates/scaffolds/show.thtml +++ b/cake/libs/view/templates/scaffolds/show.thtml @@ -30,7 +30,7 @@ name); $modelKey = Inflector::underscore($modelName); - $objModel = ClassRegistry::getObject($modelKey); + $objModel =& ClassRegistry::getObject($modelKey); ?>

Show

@@ -42,7 +42,7 @@ if(isset($value['foreignKey'])) { $alias = array_search($value['table'],$objModel->alias); - $otherModelObject = ClassRegistry::getObject(Inflector::underscore($objModel->tableToModel[$value['table']])); + $otherModelObject =& ClassRegistry::getObject(Inflector::underscore($objModel->tableToModel[$value['table']])); $displayField = $otherModelObject->getDisplayField(); $displayText = $data[$alias][$displayField];