Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

Commit

Permalink
fix BC break from DBAL 3.0 (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
gilles-g committed Oct 7, 2021
1 parent 0b95e8e commit 355aec5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions Event/Subscriber/AbstractDoctrineSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\BooleanFilterType;
use Lexik\Bundle\FormFilterBundle\Event\GetFilterConditionEvent;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;

/**
* Provide Doctrine ORM and DBAL filters.
Expand Down Expand Up @@ -35,7 +35,7 @@ public function filterValue(GetFilterConditionEvent $event)
} elseif (!is_array($values['value'])) {
$event->setCondition(
$expr->eq($event->getField(), ':'.$paramName),
array($paramName => array($values['value'], Type::STRING))
array($paramName => array($values['value'], Types::STRING))
);
}
}
Expand All @@ -56,7 +56,7 @@ public function filterBoolean(GetFilterConditionEvent $event)

$event->setCondition(
$expr->eq($event->getField(), ':'.$paramName),
array($paramName => array($value, Type::BOOLEAN))
array($paramName => array($value, Types::BOOLEAN))
);
}
}
Expand All @@ -74,7 +74,7 @@ public function filterCheckbox(GetFilterConditionEvent $event)

$event->setCondition(
$expr->eq($event->getField(), ':'.$paramName),
array($paramName => array($values['value'], Type::STRING))
array($paramName => array($values['value'], Types::STRING))
);
}
}
Expand All @@ -92,7 +92,7 @@ public function filterDate(GetFilterConditionEvent $event)

$event->setCondition(
$expr->eq($event->getField(), ':'.$paramName),
array($paramName => array($values['value'], Type::DATE))
array($paramName => array($values['value'], Types::DATE_MUTABLE))
);
}
}
Expand Down Expand Up @@ -124,7 +124,7 @@ public function filterDateTime(GetFilterConditionEvent $event)

$event->setCondition(
$expr->eq($event->getField(), ':'.$paramName),
array($paramName => array($values['value'], Type::DATETIME))
array($paramName => array($values['value'], Types::DATETIME_MUTABLE))
);
}
}
Expand Down Expand Up @@ -158,7 +158,7 @@ public function filterNumber(GetFilterConditionEvent $event)

$event->setCondition(
$expr->$op($event->getField(), ':'.$paramName),
array($paramName => array($values['value'], is_int($values['value']) ? Type::INTEGER : Type::FLOAT))
array($paramName => array($values['value'], is_int($values['value']) ? Types::INTEGER : Types::FLOAT))
);
}
}
Expand Down Expand Up @@ -191,7 +191,7 @@ public function filterNumberRange(GetFilterConditionEvent $event)
$leftParamName = sprintf('p_%s_left', str_replace('.', '_', $event->getField()));

$expression->add($expr->$leftCond($event->getField(), ':'.$leftParamName));
$params[$leftParamName] = array($leftValue, is_int($leftValue) ? Type::INTEGER : Type::FLOAT);
$params[$leftParamName] = array($leftValue, is_int($leftValue) ? Types::INTEGER : Types::FLOAT);
}
}

Expand All @@ -211,7 +211,7 @@ public function filterNumberRange(GetFilterConditionEvent $event)
$rightParamName = sprintf('p_%s_right', str_replace('.', '_', $event->getField()));

$expression->add($expr->$rightCond($event->getField(), ':'.$rightParamName));
$params[$rightParamName] = array($rightValue, is_int($rightValue) ? Type::INTEGER : Type::FLOAT);
$params[$rightParamName] = array($rightValue, is_int($rightValue) ? Types::INTEGER : Types::FLOAT);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Event/Subscriber/DoctrineORMSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
Expand Down Expand Up @@ -108,7 +108,7 @@ public function filterEntity(GetFilterConditionEvent $event)
$expr->eq($filterField, ':'.$paramName),
array($paramName => array(
$this->getEntityIdentifier($values['value'], $queryBuilder->getEntityManager()),
Type::INTEGER
Types::INTEGER
))
);
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"require": {
"php": ">=7.1",
"doctrine/orm": "2.9.*",
"doctrine/orm": "2.10",
"symfony/form": "^4.4|^5.1",
"symfony/framework-bundle": "^4.4|^5.1"
},
Expand Down

0 comments on commit 355aec5

Please sign in to comment.