merging fixes from [652] [653] [656] [658] [659] [663] [666] [667]

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@668 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2005-08-23 23:21:33 +00:00
parent dcf9a8cc38
commit bf7386ffa0
6 changed files with 24 additions and 21 deletions

View file

@ -44,7 +44,7 @@ class TestsController extends TestsHelper {
function index ()
{
$this->layout = null;
require_once TESTS.'menu.php';
require_once TESTS.'index.php';
}
/**
* Runs all library and application tests

View file

@ -49,6 +49,6 @@ $Route->connect ('/pages/*', array('controller'=>'Pages', 'action'=>'display'));
* Then we connect url '/test' to our test controller. This is helpfull in
* developement.
*/
$Route->connect ('/test', array('controller'=>'Tests', 'action'=>'test_all'));
$Route->connect ('/test', array('controller'=>'Tests', 'action'=>'index'));
?>

View file

@ -226,11 +226,11 @@ class Controller extends Object
$id = $this->params['pass'];
}
$dboFactory = DboFactory::getInstance($this->useDbConfig);
$this->db =& $dboFactory;
$model_class = Inflector::singularize($this->name);
$this->db = DboFactory::getInstance($this->useDbConfig);
if (class_exists($model_class) && ($this->uses === false))
{
$this->models[$model_class] = new $model_class($id);
@ -495,7 +495,7 @@ class Controller extends Object
$table = Inflector::singularize($this->name);
// get all of the column names.
$classRegistry = ClassRegistry::getInstance();
$classRegistry =& ClassRegistry::getInstance();
$objRegistryModel = $classRegistry->getObject($table);
foreach ($objRegistryModel->_table_info as $tables)
@ -573,7 +573,7 @@ class Controller extends Object
$fieldNames[ $tabl['name']]['options'] = array();
// get the list of options from the other model.
$registry = ClassRegistry::getInstance();
$registry =& ClassRegistry::getInstance();
$otherModel = $registry->getObject($fieldNames[ $tabl['name']]['model']);
if( is_object($otherModel) )
@ -620,7 +620,7 @@ class Controller extends Object
$fieldNames[ $tabl['name']]['options'] = array();
// get the list of options from the other model.
$registry = ClassRegistry::getInstance();
$registry =& ClassRegistry::getInstance();
$otherModel = $registry->getObject($fieldNames[ $tabl['name']]['model']);
if( is_object($otherModel) )

View file

@ -208,8 +208,19 @@ class Model extends Object
*/
function __construct ($id=false, $table=null, $db=null)
{
$this->db = $db? $db: DboFactory::getInstance();
$this->classRegistry = ClassRegistry::getInstance();
if($db != null)
{
$this->db =& $db;
}
else
{
$dboFactory = DboFactory::getInstance();
$this->db =& $dboFactory ;
}
$this->classRegistry =& ClassRegistry::getInstance();
$this->classRegistry->addObject(get_class($this), $this);
if ($id)

View file

@ -47,12 +47,6 @@ uses('log');
*/
class Object
{
/**
* Database connection, if available.
*
* @var DBO
*/
var $db = null;
/**
* Log object
@ -71,7 +65,6 @@ class Object
*/
function Object()
{
$this->db = DboFactory::getInstance();
$args = func_get_args();
register_shutdown_function(array(&$this, '__destruct'));
call_user_func_array(array(&$this, '__construct'), $args);

View file

@ -164,9 +164,7 @@ class Scaffold extends Object {
{
$model = $this->model;
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames(null,false) );
$registry = ClassRegistry::getInstance();
$objModel = $registry->getObject( $model );
$this->controllerClass->set('data', $objModel->findAll());
$this->controllerClass->set('data', $this->controllerClass->models[$this->model]->findAll());
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'list.thtml');
}
@ -263,7 +261,8 @@ class Scaffold extends Object {
function cleanUpDateFields()
{
// clean up the date fields
foreach( $this->controllerClass->models[$this->model]->_table_info as $table )
$objModel = $this->controllerClass->models[$this->model];
foreach( $objModel->_table_info as $table )
{
foreach ($table as $field)
{