Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sadapon2008/mysql_collate
https://github.com/sadapon2008/mysql_collate
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sadapon2008/mysql_collate
- Owner: sadapon2008
- Created: 2015-02-20T02:51:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-26T10:39:36.000Z (almost 8 years ago)
- Last Synced: 2024-05-29T06:10:59.387Z (6 months ago)
- Language: PHP
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MysqlCollate
Mysql datasource for CakePHP 2.x supporting COLLATE in conditions.
## Example
### 1. change datasource in database.php
```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()
```php
$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');
```