terminal42 / contao-DC_Multilingual

A multilingual DC driver storing the translations in the same table for Contao Open Source CMS
17 stars 8 forks source link

Issues with the table alias #42

Closed dmolineus closed 6 years ago

dmolineus commented 6 years ago

Internally the dc multilingual (v3) models uses aliases for the table references. This leads to issues when calling some finders which does not set the alias, f.e. findMultipleByIds. It leads to following error because the table name cannot be used in the where clause anymore.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'tl_sgc_property.id' in 'where clause'
Toflar commented 6 years ago

I cannot work on this project at all atm so if you need that bugfix, please help me out here.

dmolineus commented 6 years ago

Atm I use a workaround by replacing tl_table_name. with t1. in the find method. Not sure if this would be robust enough for a general fix. If this fix is fine with you, I'll provide a PR for it.

Toflar commented 6 years ago

ping @terminal42/pilots

aschempp commented 6 years ago

I've had similar issues in Isotope, which was the original idea for DC_Multilingual. I think I changed the implementation to use the actual table name as the prefix for the base table. Imho that could be a bugfix because noone is supposed to know how the table aliases are used atm.

@dmolineus maybe you can provide a pull request?

dmolineus commented 6 years ago

Here we go #43.