src/Utipd/MysqlModel/BaseMysqlDirectory.php
public function update($model_or_id, $update_vars, $mongo_options=[]) {
        $id = $this->extractID($model_or_id);

        $update_vars = $this->onUpdate_pre($update_vars, $model_or_id);

        $sql = $this->buildUpdateStatement($update_vars, ['id']);

        $sth = $this->connection_manager->executeWithReconnect(function($mysql_dbh) use ($sql, $update_vars, $id) {
            $sth = $mysql_dbh->prepare($sql);
            $vars = $this->removeMysqlLiterals(array_values($update_vars));
            $vars[] = $id;
            $result = $sth->execute($vars);
            return $sth;
        });

        return $sth->rowCount();
    }
public function update($model_or_id, $update_vars, $mongo_options=[]) {
        $id = $this->extractID($model_or_id);

        $update_vars = $this->onUpdate_pre($update_vars, $model_or_id);

        $sql = $this->buildUpdateStatement($update_vars, ['id']);

        $sth = $this->connection_manager->executeWithReconnect(function($mysql_dbh) use ($sql, $update_vars, $id) {
            $sth = $mysql_dbh->prepare($sql);
            $vars = $this->removeMysqlLiterals(array_values($update_vars));
            $vars[] = $id;
            $result = $sth->execute($vars);
            return $sth;
        });

        return $sth->rowCount();
    }
public function update ( $ model_or_id , $ update_vars , $ mongo_options = [ ] ) { $ id = $ this -> extractID ( $ model_or_id ) ; $ update_vars = $ this -> onUpdate_pre ( $ update_vars , $ model_or_id ) ; $ sql = $ this -> buildUpdateStatement ( $ update_vars , [ 'id' ] ) ; $ sth = $ this -> connection_manager -> executeWithReconnect ( function ( $ mysql_dbh ) use ( $ sql , $ update_vars , $ id ) { $ sth = $ mysql_dbh -> prepare ( $ sql ) ; $ vars = $ this -> removeMysqlLiterals ( array_values ( $ update_vars ) ) ; $ vars [ ] = $ id ; $ result = $ sth -> execute ( $ vars ) ; return $ sth ; } ) ; return $ sth -> rowCount ( ) ; }
updates a model in the database
@param  BaseMysqlModel|MongoID|string $model_or_id
@param  array $update_vars
@param  array $mongo_options
@return BaseMysqlModel
updates a model in the database