Ejemplo n.º 1
0
 /**
  * Stores a cleaned bean; i.e. only scalar values. This is the core of the store()
  * method. When all lists and embedded beans (parent objects) have been processed and
  * removed from the original bean the bean is passed to this method to be stored
  * in the database.
  *
  * @param OODBBean $bean the clean bean
  *
  * @return void
  */
 protected function storeBean(OODBBean $bean)
 {
     if ($bean->getMeta('tainted')) {
         list($properties, $table) = $bean->getPropertiesAndType();
         $id = $properties['id'];
         unset($properties['id']);
         $updateValues = array();
         $k1 = 'property';
         $k2 = 'value';
         foreach ($properties as $key => $value) {
             $updateValues[] = array($k1 => $key, $k2 => $value);
         }
         $bean->id = $this->writer->updateRecord($table, $updateValues, $id);
         $bean->setMeta('tainted', FALSE);
     }
 }