Get all the tables from TableRegistry in cakephp 4.4

How can I get all the tables from TableRegistry? For some reason when I execute if(TableRegistry::exists($this->getName())) for some controllers in AppController.php in beforeFilter method, it returns false and I need that to be true so that I can look for the associations of that table.
How can I solve this issue?

I solved it with a try{}catch(MissingTableClassException $exception){} block, now is working perfect.