Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt to Yii DB 2 #86

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"require": {
"php": "8.1 - 8.4",
"yiisoft/data": "dev-master",
"yiisoft/db": "^1.3"
"yiisoft/db": "dev-master"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.7.1",
Expand All @@ -43,11 +43,11 @@
"vimeo/psalm": "^5.26.1 || ^6.9.1",
"vlucas/phpdotenv": "^5.6.1",
"yiisoft/cache": "^3.0",
"yiisoft/db-mssql": "^1.2",
"yiisoft/db-mysql": "^1.2",
"yiisoft/db-oracle": "^1.3",
"yiisoft/db-pgsql": "^1.3",
"yiisoft/db-sqlite": "^1.2"
"yiisoft/db-mssql": "dev-master",
"yiisoft/db-mysql": "dev-master",
"yiisoft/db-oracle": "dev-master",
"yiisoft/db-pgsql": "dev-master",
"yiisoft/db-sqlite": "dev-master"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/FilterHandler/LikeFilterHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public function getCriteria(FilterInterface $filter, Context $context): ?Criteri
{
/** @var Like $filter */

return new Criteria(['LIKE', $filter->getField(), $filter->getValue()]);
return new Criteria(['LIKE', $filter->getField(), $filter->getValue(), 'caseSensitive' => $filter->getCaseSensitive()]);
}
}
10 changes: 5 additions & 5 deletions tests/Base/BaseQueryDataReaderTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,19 @@ public static function dataFilterSql(): array
],
'greater than or equal' => [
new GreaterThanOrEqual('column', 3.5),
'[[column]] >= \'3.5\'',
'[[column]] >= 3.5',
],
'less than' => [
new LessThan('column', 10.7),
'[[column]] < \'10.7\'',
'[[column]] < 10.7',
],
'less-than-or-equal' => [
new LessThanOrEqual('column', 100),
'[[column]] <= 100',
],
'in' => [
new In('column', [10, 20.5, 30]),
'[[column]] IN (10, \'20.5\', 30)',
'[[column]] IN (10, 20.5, 30)',
],
'like' => [
new Like('column', 'foo'),
Expand All @@ -245,11 +245,11 @@ public static function dataFilterSql(): array
],
'not greater than or equal' => [
new Not(new GreaterThanOrEqual('column', 3.5)),
'[[column]] < \'3.5\'',
'[[column]] < 3.5',
],
'not less than' => [
new Not(new LessThan('column', 10.7)),
'[[column]] >= \'10.7\'',
'[[column]] >= 10.7',
],
'not less than or equal' => [
new Not(new LessThanOrEqual('column', 100)),
Expand Down
14 changes: 7 additions & 7 deletions tests/TestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\Schema\SchemaInterface;
use Yiisoft\Db\Schema\Column\ColumnBuilder;

final class TestHelper
{
Expand All @@ -19,12 +19,12 @@ public static function loadFixtures(ConnectionInterface $db): void
$db->createCommand()->createTable(
'customer',
[
'id' => $db->getSchema()->createColumn(SchemaInterface::TYPE_INTEGER)->notNull(),
'name' => $db->getSchema()->createColumn(SchemaInterface::TYPE_STRING, 128)->notNull(),
'email' => $db->getSchema()->createColumn(SchemaInterface::TYPE_STRING, 128),
'address' => $db->getSchema()->createColumn(SchemaInterface::TYPE_TEXT),
'status' => $db->getSchema()->createColumn(SchemaInterface::TYPE_INTEGER)->defaultValue(0),
'profile_id' => $db->getSchema()->createColumn(SchemaInterface::TYPE_INTEGER),
'id' => ColumnBuilder::integer()->notNull(),
'name' => ColumnBuilder::string(128)->notNull(),
'email' => ColumnBuilder::string(128),
'address' => ColumnBuilder::text(),
'status' => ColumnBuilder::integer()->defaultValue(0),
'profile_id' => ColumnBuilder::integer(),
]
)->execute();
$db->createCommand()->batchInsert(
Expand Down
Loading