mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Refactoring set() method into Object, and adding $conditiions === true translation in DboSource
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4475 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
f377ed6d2a
commit
15f7509171
3 changed files with 21 additions and 21 deletions
|
@ -494,24 +494,6 @@ class AuthComponent extends Object {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Allows setting of multiple properties of AuthComponent in a single line of code.
|
||||
*
|
||||
* @access public
|
||||
* @param array $properties An associative array containing AuthComponent
|
||||
* properties and corresponding values.
|
||||
* @return void
|
||||
*/
|
||||
function set($properties = array()) {
|
||||
if (is_array($properties) && !empty($properties)) {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($properties as $key => $val) {
|
||||
if (array_key_exists($key, $vars)) {
|
||||
$this->{$key} = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Component shutdown. If user is logged in, wipe out redirect.
|
||||
*
|
||||
|
|
|
@ -1326,8 +1326,8 @@ class DboSource extends DataSource {
|
|||
}
|
||||
}
|
||||
|
||||
if (is_string($conditions)) {
|
||||
if (trim($conditions) == '') {
|
||||
if (is_string($conditions) || empty($conditions) || $conditions === true) {
|
||||
if (empty($conditions) || trim($conditions) == '' || $conditions === true) {
|
||||
$conditions = ' 1 = 1';
|
||||
} else {
|
||||
$start = null;
|
||||
|
@ -1365,7 +1365,7 @@ class DboSource extends DataSource {
|
|||
$clause = ' WHERE ';
|
||||
$out = $this->conditionKeysToString($conditions);
|
||||
if (empty($out)) {
|
||||
return $clause . ' (1 = 1)';
|
||||
return $clause . ' 1 = 1';
|
||||
}
|
||||
return $clause . ' (' . join(') AND (', $out) . ')';
|
||||
}
|
||||
|
|
|
@ -188,6 +188,24 @@ class Object{
|
|||
}
|
||||
return join("\n", $back);
|
||||
}
|
||||
/**
|
||||
* Allows setting of multiple properties of the object in a single line of code.
|
||||
*
|
||||
* @access public
|
||||
* @param array $properties An associative array containing AuthComponent
|
||||
* properties and corresponding values.
|
||||
* @return void
|
||||
*/
|
||||
function set($properties = array()) {
|
||||
if (is_array($properties) && !empty($properties)) {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($properties as $key => $val) {
|
||||
if (array_key_exists($key, $vars)) {
|
||||
$this->{$key} = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Used to report user friendly errors.
|
||||
* If there is a file app/error.php this file will be loaded
|
||||
|
|
Loading…
Reference in a new issue