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

Error for delete query without alias since 2.6.0 #6939

Closed
dmaicher opened this issue Dec 26, 2017 · 4 comments
Closed

Error for delete query without alias since 2.6.0 #6939

dmaicher opened this issue Dec 26, 2017 · 4 comments

Comments

@dmaicher
Copy link
Contributor

This used to work with 2.5.x:

$em->createQueryBuilder()
    ->delete(MyEntity::class)
    ->getQuery()
    ->execute();

Now with 2.6.0 I get this error:

[Syntax Error] line 0, col -1: Error: Expected Doctrine\ORM\Query\Lexer::T_IDENTIFIER, got end of string. (Doctrine\ORM\Query\QueryException)

If I add an alias it works again:

$em->createQueryBuilder()
    ->delete(MyEntity::class, 'e')
    ->getQuery()
    ->execute();

Is this BC break intentional?

@Majkl578
Copy link
Contributor

Majkl578 commented Dec 26, 2017

Similar to #6932 (missing alias in SELECT, here it's FROM), it'll be caused by the same source.
As you can see here in EBNF for 2.5.0, alias is actually supposed to be mandatory.

It should probably be fixed for 2.6.

@Tobion
Copy link
Contributor

Tobion commented Jan 7, 2018

Can confirm the bug. I'm als affected with something like $em->createQuery('DELETE FROM '.MyEntity::class)->execute();.
I don't think the alias should be required for simple queries like this.

@lcobucci
Copy link
Member

#7077 is fixing the BC-break and discussing the update of the grammar to align with JPA 2.2 for v2.6.x and v3.0

@Ocramius Ocramius added this to the 2.6.1 milestone Feb 19, 2018
@Ocramius
Copy link
Member

Handled in #7077

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants