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());
        }
    }
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());
        }
    }
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 ( ) ) ; } }
Update object record
Update object record