0
I have a user class that does not see protected variable of the class that it inherits the code is as follows
abstract class Model{
protected $conn;
public function __construct(){
$conn = Connect::getConnection();
}
}
Daughter class
class Usuario extends Model{
public function testaConexao(){
if($this->conn)
return 'sucesso';
else
return 'falha';
}
}
calling for
$user = new Usuario();
echo $user->testaConexao();
//saida: falha
Generating a log inside the Model constructor the $Conn variable is created and is different from false. But when I try to use it in the child class it no longer recognizes, returns null using $this->Conn;