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
This commit is contained in:
phpnut 2006-01-20 18:43:05 +00:00
parent c56189ac5c
commit 2407160dc5
6 changed files with 11 additions and 11 deletions

View file

@ -6,4 +6,4 @@
// +---------------------------------------------------------------------------------------------------+ //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
0.10.7.1846 RC 2
0.10.7.1849 RC 2

View file

@ -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 )

View file

@ -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;

View file

@ -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();
}

View file

@ -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) )
{

View file

@ -30,7 +30,7 @@
<?php
$modelName = Inflector::singularize($this->name);
$modelKey = Inflector::underscore($modelName);
$objModel = ClassRegistry::getObject($modelKey);
$objModel =& ClassRegistry::getObject($modelKey);
?>
<h1>Show <?php echo Inflector::humanize($modelName)?></h1>
@ -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];