I would like to pass a php object in its own constructor to another object like this:
class foo {
$parent_object;
public function __construct($obj) {
$this->parent_object = $obj;
}
}
class bar {
public function __construct() {
$blub = new foo($this);
}
}
The question I am asking myself is: Can I pass $this in the constructor of bar, because the object has not actually been created... so is $this already a valid reference to the whole object?