I'm trying to understand if everything works as should, experimenting with one-to-many relationships
A user belongs to a country (seems like a many-to-one to me)
$oCountry = R::load('country', 1); // load a fixed country
$oUser['country'] = $oCountry;
$tabelRecord = R::dispense('user');
$tabelRecord->import($oUser);
$id = R::store($tabelRecord);
At this point, where I debug, I can see a country-bean inside the user-bean, which proves I done the thing right so far.
I can only see that there is no country in my table structure, but a country-id.
There is no additional table that is used as a lookup-table, and when I do:
$dataRecords = R::find('user');
if I debug the first$datarecords, and I show a value like this:
$bean = $datarecords[1]);
$test = $bean['country']['name'];
it shows me a name, which is okay
but, if I debug the 2nd $datarecords, there is just a string value of '1' in the country_id.
So no country-bean is coupled, and when I debug again:
$bean = $datarecords[2]);
$test = $bean['country']['name'];
This gives me an error.
Please show me the light :-(