I am just starting with the basic concepts of OO in PHP,
foo.php
class Foo extends Command { public function __construct() { parent::__construct(); } public function fire() { $bar = new Bar(); } }
Bar.php
class Bar extends Foo { public function __construct() { parent::__construct(); $this->info('Bar'); } }
When I run Foo::fire() , it gives: Call to undefined method Foo::__construct() . But Foo obviously has a constructor, what am I doing wrong?
Another thing I suspect is that it could be a problem with Laravel, not PHP. This is the artisan team that I created.
EDIT:
Also calling $this->info('Bar') anywhere in the Bar will also give Call to a member function writeln() on a non-object . Why can't I call the parent method from the child class?
source share