[PR #6397] This should fix Criteria startsWith and endsWith #9968

Closed
opened 2026-01-22 16:06:01 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/6397

State: closed
Merged: No


using like this:

$criteria = Criteria::create();
//$criteria->andWhere(Criteria::expr()->contains("appName", 'a'));
$criteria->andWhere(Criteria::expr()->startsWith("group", 'doct'));
$repository->matching($criteria);
# before
SELECT ... FROM app_data t0 WHERE t0.`group`
# after
SELECT ... FROM app_data t0 WHERE t0.`group` LIKE ?

and exception if more than one expression:

An exception occurred while executing 'SELECT ... FROM app_data t0 WHERE (t0.appName LIKE ? AND t0.group )' with params ["%a%", "doct"]:

SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

**Original Pull Request:** https://github.com/doctrine/orm/pull/6397 **State:** closed **Merged:** No --- using like this: ```php $criteria = Criteria::create(); //$criteria->andWhere(Criteria::expr()->contains("appName", 'a')); $criteria->andWhere(Criteria::expr()->startsWith("group", 'doct')); $repository->matching($criteria); ``` ```sql # before SELECT ... FROM app_data t0 WHERE t0.`group` # after SELECT ... FROM app_data t0 WHERE t0.`group` LIKE ? ``` and exception if more than one expression: > An exception occurred while executing 'SELECT ... FROM app_data t0 WHERE (t0.appName LIKE ? AND t0.`group` )' with params ["%a%", "doct"]: > > SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
admin added the pull-request label 2026-01-22 16:06:01 +01:00
admin closed this issue 2026-01-22 16:06:01 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9968