我正在使用 cakeDC (with cakephp 2.x)(https://github.com/CakeDC/search) 提供的 cakephp 搜索插件的 2.0 版本。我需要在许多模型中进行搜索,但这些模型不相关。所以我创建了一个新模型(搜索)和一个控制器(搜索)。我收到了这个错误
“注意(8):间接修改重载属性 SearchesController::$paginate 无效 [APP/Controller/SearchesController.php, line 17]”
模型:
App::uses('AppModel', 'Model');
class Search extends AppModel {
public $actsAs = array('Search.Searchable');
public $useTable = false;
public $filterArgs = array(
'terminada' => array(
'type' => 'like',
'field' => array(
'Sludge.terminada',
'SurfacesWater.terminada',
'ResidualWater.termianda',
'UndergroundWater.terminada',
'PotableWater.terminada',
'SpecifiedsResidualsWater.terminada'
)
),
'revisada' => array(
'type' => 'like',
'field' => array(
'Sludge.revisada',
'SurfacesWater.revisada',
'ResidualWater.revisada',
'UndergroundWater.revisada',
'PotableWater.revisada',
'SpecifiedsResidualsWater.revisada'
)
),
'eliminada' => array(
'type' => 'like',
'field' => array(
'Sludge.eliminada',
'SurfacesWater.eliminada',
'ResidualWater.eliminada',
'UndergroundWater.eliminada',
'PotableWater.eliminada',
'SpecifiedsResidualsWater.eliminada'
)
),
);
public function orConditionsDates($data = array()) {
$start = date('Y-m-d');
$end = date('Y-m-d', strtotime('-1 month'));
$cond = array(
'OR' => array(
$this->alias . '.monitoreofecha LIKE <=' => $end,
$this->alias . '.monitoreofecha LIKE >=' => $start,
));
return $cond;
}
}
控制器:
App::uses('AppController', 'Controller');
class SearchesController extends AppController {
public $components = array('Search.Prg');
public $presetVars = true; // using the model configuration
public function index() {
$this->Prg->commonProcess();
$this->paginate['conditions'] = $this->Search->parseCriteria($this->passedArgs);
$this->set('searches', $this->paginate());
}
}
使用烘焙创建的任何索引的视图都是相同的。知道我的错误是什么吗?谢谢大家!!
S。