I am trying to save an object as property in an another class, PHP throwing notices and fatal errors. Simplified version of my code:
<?php
class A {
public function a() {
// do something
}
}
$A = new A();
class B {
private $A;
public function __constructor($A) {
$this->A = $A;
}
private function b() {
if($this->A->a()) { // This line is referred by PHP
// do something
}
}
}
$B = new B($A);