{$key} or $key?

When we perpend $ in any variable then it become Variable variable (Variable vars) like $$name

Check this reference for Variable variable.

https://www.php.net/manual/en/language.variables.variable.php

Here $this->$key will become Variable var because it is about public/private/protected variable of class.

So {} in $this->{$key} will set $key vars variable of class

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