A non-question question about OOP, the code is simplified to understand.

abstract class Two { } class One extends Two{ $res = $this->parent->get($id, array(...)); } method_exists('One', 'get')); // false 

Two abstract, it is pointless to check it. Question: where to find the get method?

  • Obviously where he is. For example, if it is implemented in an abstract class - rjhdby
  • one
    Is parent a variable? - Mikhail Vaysman
  • what is $ this-> parent? - Skywave

1 answer 1

Look in the $this->parent object itself. This property stores a reference to an instance of some of your objects, which is where the get method is called ...

Just a way to find out which instance of a class this property is - output:

 print_r($this->parent); 

And either in this class the method is declared, or it is inherited, or in the class itself or it is inherited there is an overload of __call methods - you need to find out.

And it's better to use some kind of IDE, for example, PhpStorm. It is enough to “click” on this method and in a “magical” way go to the declaration of the method if it is declared there ...