PHP Call outside class function inside anonymous function

You need to specify which variables you want your closure to have access to, using the use part of the closure — see manual.

add_action('save_post', function($id) use ($this, $post) {
    // ....
});

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)