Skip to content
Advertisement

Error: Expected Literal, got ‘*’ in Doctrine

I want to retrieve the number of rows in my courrier table.

In my fixtures, I have these lines :

JavaScript

I have these mistakes when I do symfony console doctrine:fixtures:load :

JavaScript

What’s wrong with the * in my query ?

Advertisement

Answer

Doctrine expects you to use one of the fields of your entity. In SQL you don’t need to use count(*) to get the amount of rows count(id) also works as long as the column is not nullable.

So changing your query to SELECT count(c.id) FROM AppEntityCourrier as c should solve this.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement