開発メモ

開発用のメモです。

Cakephp プラグイン サーチプラグイン

bash

cd app/Plguin/
git clone https://github.com/CakeDC/search

app/Config/bootstrap.php [add]

CakePlugin::load('Search');

app/Model/User.php

<?php
class User extends AppModel {

        var $displayField = "account";

        var $actsAs = array( "Search.Searchable" );

        var $filterArgs = array(
                array(  "name" => "id", "type" => "value" )
        );
}

app/Controllers/UsersController.php

<?php
class UsersController extends AppController {

var $components = array ( "Search.Prg" );

function index() {

        $this->Prg->commonProcess();
        $this->Paginator->settings["conditions"] = $this->User->parseCriteria($this->Prg->parsedParams());
        $this->request->list = $this->paginate();
}

}
Twitter: @asahina_alice