original_string: public function update($attributes)
      {
          try {
              self::init();
              foreach ($attributes as $column => $value) {
                  $columns[] = $column. ' = :'.$column;
              }
              $sql = 'UPDATE ' . self::$modelTable . ' SET ' . implode(', ', $columns) . ' WHERE id = ' . $this->id;
              $stm = self::$connect->prepare($sql);
              $stm->execute($attributes);
              $this->setAttributes($attributes);
              return $this;
          } catch (\Exception $exception) {
              var_dump($exception->getMessage());
          }
      }
code: public function update($attributes)
      {
          try {
              self::init();
              foreach ($attributes as $column => $value) {
                  $columns[] = $column. ' = :'.$column;
              }
              $sql = 'UPDATE ' . self::$modelTable . ' SET ' . implode(', ', $columns) . ' WHERE id = ' . $this->id;
              $stm = self::$connect->prepare($sql);
              $stm->execute($attributes);
              $this->setAttributes($attributes);
              return $this;
          } catch (\Exception $exception) {
              var_dump($exception->getMessage());
          }
      }
code_tokens: public function update ( $ attributes ) { try { self :: init ( ) ; foreach ( $ attributes as $ column => $ value ) { $ columns [ ] = $ column . ' = :' . $ column ; } $ sql = 'UPDATE ' . self :: $ modelTable . ' SET ' . implode ( ', ' , $ columns ) . ' WHERE id = ' . $ this -> id ; $ stm = self :: $ connect -> prepare ( $ sql ) ; $ stm -> execute ( $ attributes ) ; $ this -> setAttributes ( $ attributes ) ; return $ this ; } catch ( \ Exception $ exception ) { var_dump ( $ exception -> getMessage ( ) ) ; } }
docstring: Update object record
docstring_tokens: Update object record