omines / datatables-bundle

DataTables bundle for Symfony
https://omines.github.io/datatables-bundle/
MIT License
258 stars 115 forks source link

Error when loading an entity #90

Closed IlyushaZ closed 4 years ago

IlyushaZ commented 5 years ago

Hello everyone, my issue is that i have an entity called 'Order' which is reserved word in SQL, so i have some issues when building table and creating ORMAdapter with this entity. Even though i added quotes to table name like @ORM\Table(name="'order'") it's still throws an exception when loading data for datatable.

Here is my table-type code: $dataTable->add('id', TextColumn::class, [ 'label' => 'Номер' ]) ->add('title', TextColumn::class, [ 'label' => 'Название' ]) ->add('author', TextColumn::class, [ 'label' => 'Автор' ]) ->add('maker', TextColumn::class, [ 'label' => 'Исполнитель' ]) ->createAdapter(ORMAdapter::class, [ 'entity' => Order::class ]);

And the error is: [Syntax Error] line 0, col 13: Error: Expected Literal, got 'order'

Thanks for help in advance

curry684 commented 5 years ago

In general, call such columns SortOrder 😉

IlyushaZ commented 5 years ago

In general, call such columns SortOrder 😉

in this context word order doesn't refer to sorting, i meant 'booking' or something like that 😄

curry684 commented 5 years ago

Oh yes my bad you said it was the entity indeed hehe. I suspect it's just a forgotten escape (or FQCN) on our end when constructing the DQL.