Given a $profile and a $translation, you can link them like this:
$profile->ownTranslation[] = $translation;
R::store($profile);
Now RedBeanPHP will connect the translations to the profile. As for the classes, the idea is you don't need these. Imagine you have this ProfileTranslation class, how would you set the properties? Using setters?
$profTrans->setLanguageCode($lang);
Then, why not set them directly, we all know setters don't do a lot of useful stuff anyway.
$profTrans->language = $lang;
If you need some kind of validation you can add this to a class, however there is no need to redeclare properties in the class, write accessors etc. The two are 'fused' automatically by RedBeanPHP:
class Model_Translation extends RedBean_SimpleModel {
public function update() {
...validate here, just throw exception if anything is wrong...
}
}
And... you're done. No need for property declarations, no need for accessors, getters, setters... just done.
That's the power of RedBeanPHP.
Cheers, Gabor