###前提・実現したいこと
CakePHPでSearchPluginを導入して、検索機能を実装しています。
###発生している問題・エラーメッセージ
検索がうまく実行できない。
検索画面に下のようなエラーが表示される。
Indirect modification of overloaded property
CollegesController::$paginate has no effect
[APP\Controller\CollegesController.php, line 32]
###ソースコード
CollegesController.php
public function search() {
$this->College->recursive = 0;
$this->paginate = array(
'limit' => 10,
);
$this->Prg->commonProcess(); $this->paginate['conditions'] = $this->College->parseCriteria($this->passedArgs); $universitynames = $this->College->find('list'); $this->set(compact('universitynames')); }
}
College.php
<?php class College extends AppModel{ public $actsAs = array('Search.Searchable'); public $filterArgs = array( 'id' => array('type' => 'value'), 'universityname' => array('type'=>'like'), ); public function orConditions($data = array()){ $filter = $data['universityname']; $cond = array( 'OR' => array( $this->alias.'.universityname LIKE' => '%' . $filter . '%', ), ); return $cond; } public $validate = array( 'universityname' => array( 'rule' => 'notEmpty', 'message'=>'検索欄に入力してください。' ), ); } ?>