mysql - Symfony i18n table: Ways to get fallback default value? -
I'm creating a city name table in MySQL with approximately 10K rows to be a Siemphonii i18n table. Basically, The default culture is N_US and every city in the table is the beginning of this culture. Over time, I would like to add only those cities in the table, which can have alternate names in different languages, such as "London (NAUS) / London (SES)", without repeating the data of every city Language in different tables
Now, what I think, Symphony will not automatically choose a fallback default city name if there is no translation for it. So I need to prepare a solution to do the following:
If translation exists, select it .... If not, then choose the default en_US city name.
So far it seems that I should use the COALESCE
However, as I am not very familiar about it, I am thinking that to use it are lacking? I am asking this because I have to include this in the query of every city which is a very consistent action on my site.
Suggestions for any ideas, or better way to work, will be thankful too. Thank you.
Try something like this:
$ q = Doctrine_Query :: ('City C') -> () -> LeftJoin ('c.Translation ct with lang IN (?)', Array (array ('es_ES', 'en_US')) - & gt; executed ();
Comments
Post a Comment