Skip to content

Loading…

DDC-612: Query\Expr::substring() third parameter should be optional #5120

Closed
doctrinebot opened this Issue · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user @hobodave:

I'm not aware of a platform that requires all 3 arguments to SUBSTRING().

This seems to only affect queries from the QueryBuilder

The following DQL works fine:

UPDATE Common\Model\Location e SET e.path = CONCAT('00010002', SUBSTRING(e.path, 9)) WHERE e.path LIKE '00010001%'

Yet the following QueryBuilder expression:

$substr = $expr->substring('e.' . $this->getPathFieldName(), strlen($oldPath)+1);

results in:

Missing argument 3 for Doctrine\ORM\Query\Expr::substring()

If I make that argument optional, default null I get the following generated DQL and error:

"UPDATE Common\Model\Location e SET e.path = CONCAT('00010002', SUBSTRING(e.path, 9, )) WHERE e.path LIKE '00010001%'
Doctrine\ORM\Query\QueryException: [Syntax Error] line 0, col 84: Error: Expected Literal, got ')'
@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.0-BETA2 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.