mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixing Controller::postConditions() to use $this->data if no parameters are passed
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3406 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
f12f312b2e
commit
8fadeb3146
1 changed files with 20 additions and 5 deletions
|
@ -40,7 +40,7 @@
|
|||
* @subpackage cake.cake.libs.controller
|
||||
*
|
||||
*/
|
||||
class Controller extends Object{
|
||||
class Controller extends Object {
|
||||
/**
|
||||
* Name of the controller.
|
||||
*
|
||||
|
@ -96,11 +96,17 @@ class Controller extends Object{
|
|||
*/
|
||||
var $data = array();
|
||||
/**
|
||||
* Enter description here...
|
||||
* Sub-path for view files
|
||||
*
|
||||
* @var unknown_type
|
||||
* @var string
|
||||
*/
|
||||
var $viewPath = null;
|
||||
/**
|
||||
* Sub-path for layout files
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
var $layoutPath = '';
|
||||
/**
|
||||
* Variables for the view
|
||||
*
|
||||
|
@ -169,6 +175,12 @@ class Controller extends Object{
|
|||
* @var unknown_type
|
||||
*/
|
||||
var $view = 'View';
|
||||
/**
|
||||
* File extension for view templates. Defaults to Cake's conventional ".thtml".
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $ext = '.thtml';
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
|
@ -795,10 +807,13 @@ class Controller extends Object{
|
|||
* @param boolean $exclusive If true, and $op is an array, fields not included in $op will not be included in the returned conditions
|
||||
* @return array An array of model conditions
|
||||
*/
|
||||
function postConditions($data, $op = '', $bool = 'AND', $exclusive = false) {
|
||||
if (!is_array($data) || empty($data)) {
|
||||
function postConditions($data = array(), $op = '', $bool = 'AND', $exclusive = false) {
|
||||
if ((!is_array($data) || empty($data)) && empty($this->data)) {
|
||||
return null;
|
||||
} elseif ((!is_array($data) || empty($data)) && !empty($this->data)) {
|
||||
$data = $this->data;
|
||||
}
|
||||
|
||||
$cond = array();
|
||||
|
||||
foreach($data as $model => $fields) {
|
||||
|
|
Loading…
Reference in a new issue