Skip to content

Commit

Permalink
Refactor ORM QueryBuilder::setParameters() calls to use setParameter(…
Browse files Browse the repository at this point in the history
…) instead due to a stricter type in 3.0
  • Loading branch information
mbabker committed Oct 17, 2023
1 parent 43073e0 commit 67fe1ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 2 additions & 4 deletions src/Translatable/Entity/Repository/TranslationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,8 @@ public function findTranslations($entity)
->from($translationClass, 'trans')
->where('trans.foreignKey = :entityId', 'trans.objectClass = :entityClass')
->orderBy('trans.locale')
->setParameters([
'entityId' => $entityId,
'entityClass' => $entityClass,
]);
->setParameter('entityId', $entityId)
->setParameter('entityClass', $entityClass);

foreach ($qb->getQuery()->toIterable([], Query::HYDRATE_ARRAY) as $row) {
$result[$row['locale']][$row['field']] = $row['content'];
Expand Down
7 changes: 3 additions & 4 deletions src/Translatable/Mapping/Event/Adapter/ORM.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,10 @@ public function findTranslation(AbstractWrapper $wrapped, $locale, $field, $tran
'trans.locale = :locale',
'trans.field = :field'
)
->setParameter('locale', $locale)
->setParameter('field', $field)
;
$qb->setParameters([
'locale' => $locale,
'field' => $field,
]);

if ($this->usesPersonalTranslation($translationClass)) {
$qb->andWhere('trans.object = :object');
if ($wrapped->getIdentifier()) {
Expand Down
3 changes: 2 additions & 1 deletion src/Tree/Strategy/ORM/Nested.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ public function processScheduledDelete($em, $node)
$qb->select('node')
->from($config['useObjectClass'], 'node')
->where($qb->expr()->between('node.'.$config['left'], '?1', '?2'))
->setParameters([1 => $leftValue, 2 => $rightValue]);
->setParameter(1, $leftValue)
->setParameter(2, $rightValue);

if (isset($config['root'])) {
$qb->andWhere($qb->expr()->eq('node.'.$config['root'], ':rid'));
Expand Down

0 comments on commit 67fe1ea

Please sign in to comment.