src/Utipd/MysqlModel/BaseMysqlDirectory.php
public function save(BaseMysqlModel $model) {
        $create_vars = $this->onSave_pre((array)$model);
        $sql = $this->buildInsertStatement($create_vars);

        $id = $this->connection_manager->executeWithReconnect(function($mysql_dbh) use ($sql, $create_vars) {
            $sth = $mysql_dbh->prepare($sql);
            $result = $sth->execute(array_values($create_vars));
            return $mysql_dbh->lastInsertId(); 
        });

        $model['id'] = $id;

        return $model;
    }
public function save(BaseMysqlModel $model) {
        $create_vars = $this->onSave_pre((array)$model);
        $sql = $this->buildInsertStatement($create_vars);

        $id = $this->connection_manager->executeWithReconnect(function($mysql_dbh) use ($sql, $create_vars) {
            $sth = $mysql_dbh->prepare($sql);
            $result = $sth->execute(array_values($create_vars));
            return $mysql_dbh->lastInsertId(); 
        });

        $model['id'] = $id;

        return $model;
    }
public function save ( BaseMysqlModel $ model ) { $ create_vars = $ this -> onSave_pre ( ( array ) $ model ) ; $ sql = $ this -> buildInsertStatement ( $ create_vars ) ; $ id = $ this -> connection_manager -> executeWithReconnect ( function ( $ mysql_dbh ) use ( $ sql , $ create_vars ) { $ sth = $ mysql_dbh -> prepare ( $ sql ) ; $ result = $ sth -> execute ( array_values ( $ create_vars ) ) ; return $ mysql_dbh -> lastInsertId ( ) ; } ) ; $ model [ 'id' ] = $ id ; return $ model ; }
saves a new model to the database
@param  array $create_vars
@return BaseMysqlModel a new model
saves a new model to the database