Hi!
I have this challenge which consist in having a system that offers it's content in multiple languages, however a part of the data contained in the system is not translatable such as dates, ints and such.
I mean if I have a content on the following YAML
Corporativos:
columns:
nombre:
type: string(254)
notnull: true
telefonos:
type: string(500)
email:
type: string(254)
webpage:
type: string(254)
CorporativosLang:
columns:
corporativo_id:
type: integer(8)
notnull: true
lang:
type: string(16)
fixed: false
ubicacion:
type: string()
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
contacto:
type: string()
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
tipo_de_hoteles:
type: string(254)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
paises:
type: string()
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
relations:
Corporativo:
class: Corporativos
local: corporativo_id
foreign: id
type: one
foreignAlias: Data
This would allow me to have different corporative offices, however the place of the corp, the contact and other things can be translate into a different language (lang)
Now this code here would create me a brand new corporative office with 2 translations
$corporativo = new Corporativos();
$corporativo->nombre = 'Duck Corp';
$corporativo->telefonos = '66303713333';
$corporativo->email = '
[email protected]';
$corporativo->webpage = 'http://quack.com';
$corporativo->Data[0]->lang = 'en';
$corporativo->Data[0]->ubicacion = 'zomg';
$corporativo->Data[1]->lang = 'es';
$corporativo->Data[1]->ubicacion = 'zomg amigou';
the thing now is I don't know how to retrieve this data in a more friendly way, because if I'd like to access my Corporative info in english I'd had to run DQL
for the corp and then another DQL
for the specific translation in english,
What I'd love to do is have my translatable fields available in the root so I could simply access them
$corporativo = new Corporativos();
$corporativo->nombre = 'Duck Corp';
$corporativo->telefonos = '66303713333';
$corporativo->email = '
[email protected]';
$corporativo->webpage = 'http://quack.com';
$corporativo->lang = 'en';
$corporativo->ubicacion = 'zomg';
this way the translatable fields would be mapped to the second table automatically.
I hope I can explain my self clear :(
any suggestions ?