mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
merging [880] [881] [882] and [883] fixes
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@884 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
7eb53efb5b
commit
a86866a7a1
13 changed files with 231 additions and 169 deletions
|
@ -75,7 +75,7 @@ class Cache extends Model {
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
var $use_table = 'cache';
|
||||
var $useTable = 'cache';
|
||||
|
||||
/**
|
||||
* Constructor. Generates an md5'ed id for internal use. Calls the constructor on Model as well.
|
||||
|
@ -111,7 +111,7 @@ class Cache extends Model {
|
|||
{
|
||||
$data = addslashes($this->for_caching.$content);
|
||||
$expire = date("Y-m-d H:i:s",time()+($keep_for>0? $keep_for: 999999999));
|
||||
return $this->query("REPLACE {$this->use_table} (id,data,expire) VALUES ('{$this->id}', '{$data}', '{$expire}')");
|
||||
return $this->query("REPLACE {$this->useTable} (id,data,expire) VALUES ('{$this->id}', '{$data}', '{$expire}')");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,7 +155,7 @@ class Cache extends Model {
|
|||
*/
|
||||
function clear()
|
||||
{
|
||||
return $this->query("DELETE FROM {$this->use_table}");
|
||||
return $this->query("DELETE FROM {$this->useTable}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ class Controller extends Object
|
|||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function contructClasses(){
|
||||
function constructClasses(){
|
||||
|
||||
if(empty($this->params['pass']))
|
||||
{
|
||||
|
@ -261,6 +261,28 @@ class Controller extends Object
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($this->beforeFilter))
|
||||
{
|
||||
if(is_array($this->beforeFilter))
|
||||
{
|
||||
foreach($this->beforeFilter as $filter)
|
||||
{
|
||||
if(is_callable(array($this,$filter)))
|
||||
{
|
||||
$this->$filter();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(is_callable(array($this,$this->beforeFilter)))
|
||||
{
|
||||
$this->{$this->beforeFilter}();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -394,9 +416,9 @@ class Controller extends Object
|
|||
* Renders the Missing Table web page.
|
||||
*
|
||||
*/
|
||||
function missingTable($table_name)
|
||||
function missingTable($tableName)
|
||||
{
|
||||
$this->missingTableName = $table_name;
|
||||
$this->missingTableName = $tableName;
|
||||
$this->pageTitle = 'Missing Database Table';
|
||||
//We are simulating action call below, this is not a filename!
|
||||
$this->render('../errors/missingTable');
|
||||
|
@ -517,7 +539,7 @@ class Controller extends Object
|
|||
$classRegistry =& ClassRegistry::getInstance();
|
||||
$objRegistryModel = $classRegistry->getObject(Inflector::singularize($model));
|
||||
|
||||
foreach ($objRegistryModel->_table_info as $tables)
|
||||
foreach ($objRegistryModel->_tableInfo as $tables)
|
||||
{
|
||||
foreach ($tables as $tabl)
|
||||
{
|
||||
|
|
|
@ -129,12 +129,12 @@ class DBO_AdoDB extends DBO
|
|||
/**
|
||||
* Returns an array of the fields in given table name.
|
||||
*
|
||||
* @param string $table_name Name of database table to inspect
|
||||
* @param string $tableName Name of database table to inspect
|
||||
* @return array Fields in table. Keys are name and type
|
||||
*/
|
||||
function fields ($table_name)
|
||||
function fields ($tableName)
|
||||
{
|
||||
$data = $this->_adodb->MetaColumns($table_name);
|
||||
$data = $this->_adodb->MetaColumns($tableName);
|
||||
$fields = false;
|
||||
|
||||
foreach ($data as $item)
|
||||
|
|
|
@ -89,7 +89,7 @@ class DBO_generic extends DBO
|
|||
* Abstract method defined in subclasses.
|
||||
*
|
||||
*/
|
||||
function fields ($table_name)
|
||||
function fields ($tableName)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -135,13 +135,13 @@ class DBO_MySQL extends DBO
|
|||
/**
|
||||
* Returns an array of the fields in given table name.
|
||||
*
|
||||
* @param string $table_name Name of database table to inspect
|
||||
* @param string $tableName Name of database table to inspect
|
||||
* @return array Fields in table. Keys are name and type
|
||||
*/
|
||||
function fields ($table_name)
|
||||
function fields ($tableName)
|
||||
{
|
||||
$fields = false;
|
||||
$cols = $this->all("DESC {$table_name}");
|
||||
$cols = $this->all("DESC {$tableName}");
|
||||
|
||||
foreach ($cols as $column)
|
||||
{
|
||||
|
|
|
@ -167,12 +167,12 @@ class DBO_Pear extends DBO
|
|||
/**
|
||||
* Returns an array of the fields in given table name.
|
||||
*
|
||||
* @param string $table_name Name of database table to inspect
|
||||
* @param string $tableName Name of database table to inspect
|
||||
* @return array Fields in table. Keys are name and type
|
||||
*/
|
||||
function fields ($table_name)
|
||||
function fields ($tableName)
|
||||
{
|
||||
$data = $this->_pear->tableInfo($table_name);
|
||||
$data = $this->_pear->tableInfo($tableName);
|
||||
$fields = false;
|
||||
|
||||
foreach ($data as $item)
|
||||
|
|
|
@ -133,12 +133,12 @@ class DBO_Postgres extends DBO
|
|||
/**
|
||||
* Returns an array of the fields in given table name.
|
||||
*
|
||||
* @param string $table_name Name of database table to inspect
|
||||
* @param string $tableName Name of database table to inspect
|
||||
* @return array Fields in table. Keys are name and type
|
||||
*/
|
||||
function fields ($table_name)
|
||||
function fields ($tableName)
|
||||
{
|
||||
$sql = "SELECT c.relname, a.attname, t.typname FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '{$table_name}' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid";
|
||||
$sql = "SELECT c.relname, a.attname, t.typname FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '{$tableName}' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid";
|
||||
|
||||
$fields = false;
|
||||
foreach ($this->all($sql) as $field) {
|
||||
|
|
|
@ -132,13 +132,13 @@ class DBO_SQLite extends DBO
|
|||
/**
|
||||
* Returns an array of the fields in given table name.
|
||||
*
|
||||
* @param string $table_name Name of database table to inspect
|
||||
* @param string $tableName Name of database table to inspect
|
||||
* @return array Fields in table. Keys are name and type
|
||||
*/
|
||||
function fields($table_name)
|
||||
function fields($tableName)
|
||||
{
|
||||
$fields = false;
|
||||
$cols = sqlite_fetch_column_types($table_name, $this->_conn);
|
||||
$cols = sqlite_fetch_column_types($tableName, $this->_conn);
|
||||
|
||||
foreach ($cols as $column => $type)
|
||||
{
|
||||
|
|
|
@ -161,7 +161,7 @@ class Dispatcher extends Object
|
|||
}
|
||||
}
|
||||
|
||||
$controller->contructClasses();
|
||||
$controller->constructClasses();
|
||||
|
||||
if ($missingAction)
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ class JavascriptHelper extends Helper
|
|||
*/
|
||||
function codeBlock($script)
|
||||
{
|
||||
return sprintf($this->tags['javascriptBlock'], $script);
|
||||
return sprintf($this->tags['javascriptblock'], $script);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +60,7 @@ class JavascriptHelper extends Helper
|
|||
*/
|
||||
function link($url)
|
||||
{
|
||||
return sprintf($this->tags['javascriptLink'], $this->base.$url);
|
||||
return sprintf($this->tags['javascriptlink'], $this->base.$url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,7 +71,7 @@ class JavascriptHelper extends Helper
|
|||
*/
|
||||
function linkOut($url)
|
||||
{
|
||||
return sprintf($this->tags['javascriptLink'], $url);
|
||||
return sprintf($this->tags['javascriptlink'], $url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -193,12 +193,12 @@ class Inflector extends Object
|
|||
/**
|
||||
* Returns Cake class name ("Post" for the database table "posts".) for given database table.
|
||||
*
|
||||
* @param string $table_name Name of database table to get class name for
|
||||
* @param string $tableName Name of database table to get class name for
|
||||
* @return string
|
||||
*/
|
||||
function classify($table_name)
|
||||
function classify($tableName)
|
||||
{
|
||||
return Inflector::camelize(Inflector::singularize($table_name));
|
||||
return Inflector::camelize(Inflector::singularize($tableName));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
314
libs/model.php
314
libs/model.php
|
@ -68,7 +68,7 @@ class Model extends Object
|
|||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $use_table = false;
|
||||
var $useTable = false;
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
|
@ -100,7 +100,7 @@ class Model extends Object
|
|||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $_table_info = null;
|
||||
var $_tableInfo = null;
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
|
@ -232,12 +232,12 @@ class Model extends Object
|
|||
$this->id = $id;
|
||||
}
|
||||
|
||||
$table_name = $table? $table: ($this->use_table? $this->use_table: Inflector::tableize(get_class($this)));
|
||||
$tableName = $table? $table: ($this->useTable? $this->useTable: Inflector::tableize(get_class($this)));
|
||||
//Table Prefix Hack - Check to see if the function exists.
|
||||
if (in_array('settableprefix', get_class_methods(get_class($this)))) $this->setTablePrefix();
|
||||
// Table Prefix Hack - Get the prefix for this view.
|
||||
$this->tablePrefix? $this->useTable($this->tablePrefix.$table_name): $this->useTable ($table_name);
|
||||
//$this->useTable ($table_name);
|
||||
$this->tablePrefix? $this->useTable($this->tablePrefix.$tableName): $this->useTable ($tableName);
|
||||
//$this->useTable ($tableName);
|
||||
parent::__construct();
|
||||
$this->createLinks();
|
||||
}
|
||||
|
@ -752,18 +752,18 @@ class Model extends Object
|
|||
/**
|
||||
* Sets a custom table for your controller class. Used by your controller to select a database table.
|
||||
*
|
||||
* @param string $table_name Name of the custom table
|
||||
* @param string $tableName Name of the custom table
|
||||
*/
|
||||
function useTable ($table_name)
|
||||
function useTable ($tableName)
|
||||
{
|
||||
if (!in_array(strtolower($table_name), $this->db->tables()))
|
||||
if (!in_array(strtolower($tableName), $this->db->tables()))
|
||||
{
|
||||
$this->_throwMissingTable($table_name);
|
||||
$this->_throwMissingTable($tableName);
|
||||
die();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->table = $table_name;
|
||||
$this->table = $tableName;
|
||||
$this->loadInfo();
|
||||
}
|
||||
}
|
||||
|
@ -845,11 +845,11 @@ class Model extends Object
|
|||
*/
|
||||
function loadInfo ()
|
||||
{
|
||||
if (empty($this->_table_info))
|
||||
if (empty($this->_tableInfo))
|
||||
{
|
||||
$this->_table_info = new NeatArray($this->db->fields($this->table));
|
||||
$this->_tableInfo = new NeatArray($this->db->fields($this->table));
|
||||
}
|
||||
return $this->_table_info;
|
||||
return $this->_tableInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -861,11 +861,11 @@ class Model extends Object
|
|||
*/
|
||||
function hasField ($name)
|
||||
{
|
||||
if (empty($this->_table_info))
|
||||
if (empty($this->_tableInfo))
|
||||
{
|
||||
$this->loadInfo();
|
||||
}
|
||||
return $this->_table_info->findIn('name', $name);
|
||||
return $this->_tableInfo->findIn('name', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1290,133 +1290,16 @@ class Model extends Object
|
|||
|
||||
if(!empty($this->_oneToMany))
|
||||
{
|
||||
|
||||
$datacheck = $data;
|
||||
$original = $data;
|
||||
foreach ($this->_oneToMany as $rule)
|
||||
{
|
||||
$count = 0;
|
||||
list($table, $field, $value) = $rule;
|
||||
|
||||
foreach ($datacheck as $key => $value1)
|
||||
{
|
||||
foreach ($value1 as $key2 => $value2)
|
||||
{
|
||||
if($key2 === Inflector::singularize($this->table))
|
||||
{
|
||||
$oneToManySelect[$table] = $this->db->all("SELECT * FROM {$table} WHERE ($field) = '{$value2['id']}'");
|
||||
|
||||
if( !empty($oneToManySelect[$table]) && is_array($oneToManySelect[$table]))
|
||||
{
|
||||
$newKey = Inflector::singularize($table);
|
||||
foreach ($oneToManySelect[$table] as $key => $value)
|
||||
{
|
||||
$oneToManySelect1[$table][$key] = $value[$newKey];
|
||||
}
|
||||
$merged = array_merge_recursive($data[$count],$oneToManySelect1);
|
||||
$newdata[$count] = $merged;
|
||||
unset( $oneToManySelect[$table], $oneToManySelect1);
|
||||
}
|
||||
if(!empty($newdata[$count]))
|
||||
{
|
||||
$original[$count] = $newdata[$count];
|
||||
}
|
||||
}
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
if(empty($newValue2) && !empty($original))
|
||||
{
|
||||
for ($i = 0; $i< count($original); $i++)
|
||||
{
|
||||
$newValue2[$i] = $original[$i];
|
||||
}
|
||||
if(count($this->_oneToMany < 2))
|
||||
{
|
||||
$newValue = $newValue2;
|
||||
}
|
||||
}
|
||||
elseif(!empty($original))
|
||||
{
|
||||
for ($i = 0; $i< count($original); $i++)
|
||||
{
|
||||
$newValue[$i] = array_merge($newValue2[$i], $original[$i]);
|
||||
}
|
||||
}
|
||||
$this->joinedHasMany[] = new NeatArray($this->db->fields($table));
|
||||
}
|
||||
$newValue = $this->_findOneToMany($data);
|
||||
if(!empty($newValue))
|
||||
{
|
||||
$data = $newValue;
|
||||
unset($newValue);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($this->_manyToMany))
|
||||
{
|
||||
$datacheck = $data;
|
||||
$original = $data;
|
||||
foreach ($this->_manyToMany as $rule)
|
||||
{
|
||||
$count = 0;
|
||||
list($table, $field, $value, $joineTable, $joinKey1, $JoinKey2) = $rule;
|
||||
|
||||
foreach ($datacheck as $key => $value1)
|
||||
{
|
||||
foreach ($value1 as $key2 => $value2)
|
||||
{
|
||||
if($key2 === Inflector::singularize($this->table))
|
||||
{
|
||||
if( 0 == strncmp($key2, $joinKey1, strlen($key2)) )
|
||||
{
|
||||
if(!empty ($value2['id']))
|
||||
{
|
||||
$tmpSQL = "SELECT * FROM {$table}
|
||||
JOIN {$joineTable} ON {$joineTable}.{$joinKey1} = '$value2[id]'
|
||||
AND {$joineTable}.{$JoinKey2} = {$table} .id";
|
||||
$manyToManySelect[$table] = $this->db->all($tmpSQL);
|
||||
}
|
||||
|
||||
if( !empty($manyToManySelect[$table]) && is_array($manyToManySelect[$table]))
|
||||
{
|
||||
$newKey = Inflector::singularize($table);
|
||||
foreach ($manyToManySelect[$table] as $key => $value)
|
||||
{
|
||||
$manyToManySelect1[$table][$key] = $value[$newKey];
|
||||
}
|
||||
$merged = array_merge_recursive($data[$count],$manyToManySelect1);
|
||||
$newdata[$count] = $merged;
|
||||
unset( $manyToManySelect[$table], $manyToManySelect1 );
|
||||
}
|
||||
if(!empty($newdata[$count]))
|
||||
{
|
||||
$original[$count] = $newdata[$count];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
if(empty($newValue2) && !empty($original))
|
||||
{
|
||||
for ($i = 0; $i< count($original); $i++)
|
||||
{
|
||||
$newValue2[$i] = $original[$i];
|
||||
}
|
||||
if(count($this->_manyToMany < 2))
|
||||
{
|
||||
$newValue = $newValue2;
|
||||
}
|
||||
}
|
||||
elseif(!empty($original))
|
||||
{
|
||||
for ($i = 0; $i< count($original); $i++)
|
||||
{
|
||||
$newValue[$i] = array_merge($newValue2[$i], $original[$i]);
|
||||
}
|
||||
}
|
||||
$this->joinedHasAndBelongs[] = new NeatArray($this->db->fields($table));
|
||||
}
|
||||
$newValue = $this->_findManyToMany($data);
|
||||
if(!empty($newValue))
|
||||
{
|
||||
$data = $newValue;
|
||||
|
@ -1424,7 +1307,145 @@ class Model extends Object
|
|||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $data
|
||||
* @return unknown
|
||||
*/
|
||||
function _findOneToMany(&$data)
|
||||
{
|
||||
$datacheck = $data;
|
||||
$original = $data;
|
||||
foreach ($this->_oneToMany as $rule)
|
||||
{
|
||||
$count = 0;
|
||||
list($table, $field, $value) = $rule;
|
||||
foreach ($datacheck as $key => $value1)
|
||||
{
|
||||
foreach ($value1 as $key2 => $value2)
|
||||
{
|
||||
if($key2 === Inflector::singularize($this->table))
|
||||
{
|
||||
$oneToManySelect[$table] = $this->db->all("SELECT * FROM {$table}
|
||||
WHERE ($field) = '{$value2['id']}'");
|
||||
if( !empty($oneToManySelect[$table]) && is_array($oneToManySelect[$table]))
|
||||
{
|
||||
$newKey = Inflector::singularize($table);
|
||||
foreach ($oneToManySelect[$table] as $key => $value)
|
||||
{
|
||||
$oneToManySelect1[$table][$key] = $value[$newKey];
|
||||
}
|
||||
$merged = array_merge_recursive($data[$count],$oneToManySelect1);
|
||||
$newdata[$count] = $merged;
|
||||
unset( $oneToManySelect[$table], $oneToManySelect1);
|
||||
}
|
||||
if(!empty($newdata[$count]))
|
||||
{
|
||||
$original[$count] = $newdata[$count];
|
||||
}
|
||||
}
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
if(empty($newValue2) && !empty($original))
|
||||
{
|
||||
for ($i = 0; $i< count($original); $i++)
|
||||
{
|
||||
$newValue2[$i] = $original[$i];
|
||||
}
|
||||
if(count($this->_oneToMany < 2))
|
||||
{
|
||||
$newValue = $newValue2;
|
||||
}
|
||||
}
|
||||
elseif(!empty($original))
|
||||
{
|
||||
for ($i = 0; $i< count($original); $i++)
|
||||
{
|
||||
$newValue[$i] = array_merge($newValue2[$i], $original[$i]);
|
||||
}
|
||||
}
|
||||
$this->joinedHasMany[] = new NeatArray($this->db->fields($table));
|
||||
}
|
||||
return $newValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $data
|
||||
* @return unknown
|
||||
*/
|
||||
function _findManyToMany(&$data)
|
||||
{
|
||||
$datacheck = $data;
|
||||
$original = $data;
|
||||
foreach ($this->_manyToMany as $rule)
|
||||
{
|
||||
$count = 0;
|
||||
list($table, $field, $value, $joineTable, $joinKey1, $JoinKey2) = $rule;
|
||||
|
||||
foreach ($datacheck as $key => $value1)
|
||||
{
|
||||
foreach ($value1 as $key2 => $value2)
|
||||
{
|
||||
if($key2 === Inflector::singularize($this->table))
|
||||
{
|
||||
if( 0 == strncmp($key2, $joinKey1, strlen($key2)) )
|
||||
{
|
||||
if(!empty ($value2['id']))
|
||||
{
|
||||
$tmpSQL = "SELECT * FROM {$table}
|
||||
JOIN {$joineTable} ON {$joineTable}.{$joinKey1} = '$value2[id]'
|
||||
AND {$joineTable}.{$JoinKey2} = {$table} .id";
|
||||
|
||||
$manyToManySelect[$table] = $this->db->all($tmpSQL);
|
||||
}
|
||||
if( !empty($manyToManySelect[$table]) && is_array($manyToManySelect[$table]))
|
||||
{
|
||||
$newKey = Inflector::singularize($table);
|
||||
foreach ($manyToManySelect[$table] as $key => $value)
|
||||
{
|
||||
$manyToManySelect1[$table][$key] = $value[$newKey];
|
||||
}
|
||||
$merged = array_merge_recursive($data[$count],$manyToManySelect1);
|
||||
$newdata[$count] = $merged;
|
||||
unset( $manyToManySelect[$table], $manyToManySelect1 );
|
||||
}
|
||||
if(!empty($newdata[$count]))
|
||||
{
|
||||
$original[$count] = $newdata[$count];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
if(empty($newValue2) && !empty($original))
|
||||
{
|
||||
for ($i = 0; $i< count($original); $i++)
|
||||
{
|
||||
$newValue2[$i] = $original[$i];
|
||||
}
|
||||
if(count($this->_manyToMany < 2))
|
||||
{
|
||||
$newValue = $newValue2;
|
||||
}
|
||||
}
|
||||
elseif(!empty($original))
|
||||
{
|
||||
for ($i = 0; $i< count($original); $i++)
|
||||
{
|
||||
$newValue[$i] = array_merge($newValue2[$i], $original[$i]);
|
||||
}
|
||||
}
|
||||
$this->joinedHasAndBelongs[] = new NeatArray($this->db->fields($table));
|
||||
}
|
||||
return $newValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all rows for given SQL statement.
|
||||
*
|
||||
|
@ -1601,6 +1622,11 @@ class Model extends Object
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function getDisplayField()
|
||||
{
|
||||
// $displayField defaults to 'name'
|
||||
|
@ -1618,19 +1644,33 @@ class Model extends Object
|
|||
return $dispField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function getLastInsertID()
|
||||
{
|
||||
return $this->db->lastInsertId($this->table, 'id');
|
||||
}
|
||||
|
||||
function _throwMissingTable($table_name)
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $tableName
|
||||
*/
|
||||
function _throwMissingTable($tableName)
|
||||
{
|
||||
$error = new AppController();
|
||||
$error->missingTable = get_class($this);
|
||||
call_user_func_array(array(&$error, 'missingTable'), $table_name);
|
||||
call_user_func_array(array(&$error, 'missingTable'), $tableName);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function _throwMissingConnection()
|
||||
{
|
||||
$error = new AppController();
|
||||
|
|
|
@ -114,7 +114,7 @@ class Scaffold extends Object {
|
|||
$this->scaffoldTitle = Inflector::humanize($this->modelKey);
|
||||
$this->controllerClass->layout = 'scaffold';
|
||||
$this->controllerClass->pageTitle = $this->scaffoldTitle;
|
||||
$this->controllerClass->contructClasses();
|
||||
$this->controllerClass->constructClasses();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -250,7 +250,7 @@ class Scaffold extends Object {
|
|||
{
|
||||
// clean up the date fields
|
||||
$objModel = $this->controllerClass->models[$this->modelKey];
|
||||
foreach( $objModel->_table_info as $table )
|
||||
foreach( $objModel->_tableInfo as $table )
|
||||
{
|
||||
foreach ($table as $field)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue