sadapon2008 / mysql_collate
Mysql Datasource For CakePHP supporting COLLATE in conditions
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
This package is not auto-updated.
Last update: 2024-12-17 05:07:24 UTC
README
Mysql datasource for CakePHP 2.x supporting COLLATE in conditions.
Example
1. change datasource in database.php
public $default = array( 'datasource' => 'MysqlCollate.Database/MysqlCollate', 'persistent' => false, 'host' => 'localhost', 'port' => '', 'login' => 'cakeBlog', 'password' => 'c4k3-rUl3Z', 'database' => 'cake_blog_tutorial', 'schema' => '', 'prefix' => '', 'encoding' => 'utf8' );
2. load MysqlCollateBehavior before Model::find()
$options = array( 'condition' = array( 'Post.title LIKE' => 'aBcD', ), 'order' => array( 'Post.id' => 'ASC', ), ); $this->Post->Behaviors->load( 'MysqlCollate.MysqlCollate', array( 'Post.title' => 'utf8_unicode_ci', ) ); $result = $this->Post->find('all', $options); $this->Post->Behaviors->unload('MysqlCollate');