title: RedBean Data Not Synchronized
body: <p>So, I've been trying to use RedBean PHP in my latest projects, and now I'm faced with this weird problem.</p>
  
  <p>I have a simple data structure, Provinces and Countries, and I have this code to save the Province data to my database :</p>
  
  <pre><code>$app-&gt;post('/admin/provinces/add', function () use ($app)
  {
      $province = R::dispense('province');
      $province-&gt;name = $app-&gt;request()-&gt;post('name');
  
      $country = R::load('country', $app-&gt;request()-&gt;post('country_id'));
      $country-&gt;ownProvince[] = $province;
  
      $errors = array();
  
      if (!V::alpha()-&gt;notEmpty()-&gt;validate($province-&gt;name)) $errors[] = 'Province name is required!';
  
      if (empty($errors)) {
          $id = R::store($province);
          R::store($country);
          $app-&gt;redirect(BASE_PATH.'admin/provinces/view/'.$id, 301);
      } else {
          $app-&gt;flash('errors', $errors);
          $app-&gt;redirect(BASE_PATH.'admin/provinces/add', 301);
      }
  });
  </code></pre>
  
  <p>This code works well, the relationship between the Province and the Country data are saved successfully. I can access the Country data from the Province bean vice versa just fine.</p>
  
  <p>However, when I imported the existing province data to my database from other database, I cannot access the Country data from the Province data with this code :</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>$app-&gt;get('/admin/provinces', function () use ($app)
  {
      $provinces = R::findAll('province', 'ORDER BY name');
      R::preload($provinces, array('country'));
  
      $app-&gt;render('admin/provinces/index.html.twig', array(
          'provinces' =&gt; $provinces
      ));
  });
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>&lt;table class="table table-striped table-hover"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style="width: 10%"&gt;{{ b.a("admin/provinces?order=id", "ID") }}&lt;/th&gt;
              &lt;th style="width: 45%"&gt;{{ b.a("admin/provinces?order=provincename", "Name") }}&lt;/th&gt;
              &lt;th style="width: 45%"&gt;{{ b.a("admin/provinces?order=provincename", "Country") }}&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          {% for province in provinces %}
              &lt;tr&gt;
                  &lt;td&gt;{{ province.id }}&lt;/td&gt;
                  &lt;td&gt;{{ b.a("admin/provinces/view/"~province.id, province.name) }}&lt;/td&gt;
                  &lt;td&gt;{{ b.a("admin/countries/view/"~province.country.id, province.country.name) }}&lt;/td&gt;
              &lt;/tr&gt;
          {% endfor %}
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>The strange thing is, this code works :</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>$app-&gt;get('/admin/provinces/view/:id', function ($id) use ($app)
  {
      $province = R::load('province', $id);
      $country = $province-&gt;country;
  
      $app-&gt;render('admin/provinces/view.html.twig', array(
          'province' =&gt; $province,
          'country' =&gt; $country
      ));
  });
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>&lt;dl class="dl-horizontal"&gt;
      &lt;dt&gt;Name&lt;/dt&gt;&lt;dd&gt;{{ province.name }}&lt;/dd&gt;
      &lt;dt&gt;Country&lt;/dt&gt;&lt;dd&gt;{{ b.a("admin/countries/view/"~country.id, country.name) }}&lt;/dd&gt;
  &lt;/dl&gt;
  </code></pre>
  
  <p>So, where did I gone wrong? Why can I display the Country data from a single Province, but I cannot with get the related Country from multiple Provinces?</p>
  
  <p>Also, if I input the Province data manually, all of those codes works fine. However, it doesn't work if I import the data from another database</p>
  
  <p>I'm using the latest RedBean (downloaded the rb.php yesterday) by the way.</p>