Closed tomfischerNL closed 3 years ago
Can you provide the error stack that is in the profiler ?
I had a similar case because doctrine had transformed the query alias into a reserved word for my DBMS. I worked around the problem with a query in my datatable to define the alias myself.
Hi Maxhelias,
This is the stack trace:
I think it's the same case as me because the word "order" must be interpreted as "order by" in sql. Try something like this :
->createAdapter(ORMAdapter::class, [
'entity' => Order::class,
'query' => static function (QueryBuilder $builder): void {
$builder
->select('o')
->from(Order::class, 'o')
;
},
])
This is a Doctrine issue, not related specifically to this bundle.
In general, try not to have entities called select
, insert
, order
, where
or other SQL-reserved words. It gets messy 😉
Using Symfony version 5.2.1
I have multiple Entities: User, Account, OrderItem and Order.
When I use the following code, it works:
$table = $dataTableFactory->create() ->add('id', TextColumn::class) ->createAdapter(ORMAdapter::class, [ 'entity' => User::class ]) ->handleRequest($request);
But when I use the Order entity, it fails (500 error)
$table = $dataTableFactory->create() ->add('id', TextColumn::class) ->createAdapter(ORMAdapter::class, [ 'entity' => Order::class ]) ->handleRequest($request);
Every entity I use works, except the Order entity. Has this something to do with the fact that the name "order" is ambiguous, because it is also a "order" term, for sorting.
Thanks in advance,