RedBeanPHP\Repository\Fluid::storeBean PHP Method

storeBean() protected method

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.
protected storeBean ( RedBeanPHP\OODBBean $bean ) : void
$bean RedBeanPHP\OODBBean the clean bean
return void
    protected function storeBean(OODBBean $bean)
    {
        if ($bean->getMeta('changed')) {
            $this->check($bean);
            $table = $bean->getMeta('type');
            $this->createTableIfNotExists($bean, $table);
            $updateValues = array();
            foreach ($bean as $property => $value) {
                if ($property !== 'id') {
                    $this->modifySchema($bean, $property, $value);
                }
                if ($property !== 'id') {
                    $updateValues[] = array('property' => $property, 'value' => $value);
                }
            }
            $bean->id = $this->writer->updateRecord($table, $updateValues, $bean->id);
            $bean->setMeta('changed', FALSE);
        }
        $bean->setMeta('tainted', FALSE);
    }