mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
merging changes from source:whiteboard/sandbox/phpnut/pre_0.9.2 in revisions [343] and [344]
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@345 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
6460f6e83f
commit
3c5c99423d
2 changed files with 4 additions and 10 deletions
|
@ -379,7 +379,7 @@ class DBO extends Object
|
|||
function hasAny($table, $sql)
|
||||
{
|
||||
$out = $this->one("SELECT COUNT(*) AS count FROM {$table}".($sql? " WHERE {$sql}":""));
|
||||
return is_array($out)? $out['count']: false;
|
||||
return is_array($out)? $out[0]['count']: false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -325,10 +325,9 @@ class Model extends Object
|
|||
break;
|
||||
}
|
||||
|
||||
if(!is_a($this->$className, $className))
|
||||
if(!isset($this->$className))
|
||||
{
|
||||
$this->$className = new $className();
|
||||
|
||||
$this->$className = new $className();
|
||||
}
|
||||
$this->{$joinedHas}[] = $this->$className;
|
||||
$this->relink();
|
||||
|
@ -603,15 +602,10 @@ class Model extends Object
|
|||
$fields[] = 'modified';
|
||||
$values[] = 'NOW()';
|
||||
}
|
||||
|
||||
$out = $this->db->one("SELECT COUNT(*) AS count FROM {$this->table} WHERE id = '{$this->id}'");
|
||||
|
||||
if(empty($out[0]['count']))
|
||||
if(!$this->exists())
|
||||
{
|
||||
$this->id = false;
|
||||
}
|
||||
|
||||
|
||||
if(count($fields))
|
||||
{
|
||||
if(!empty($this->id)){
|
||||
|
|
Loading…
Reference in a new issue