Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
I am trying to build a translatable API.
With such structure, I could for example find sometable id.1 with strings in languaage 'en' with a simple LEFT JOIN:
However, I am having some trouble seeing how to implement something like this in Cortex. Has any one some idea about how to do it, or any kind of alternative way?
This looks like a simple has relation to me. I.e. if there are multiple i18n entries regarding sometable.id=1, it's a has-many <> belongs-to-one
SomeTableModel with $fieldconf:
and Sometable_i18nModel with
to do the query:
$sometable = new Sometable(); $sometable->has('i18n', ['langcode = ?', 'en']); $sometable->load(['id = ?', 1]); foreach($sometable->i18n ?:  as $i18n) echo $i18n->translateddata1;
In case it's a 1:1 relation, it's only has-one at the other end and