Here’s what I did:
Let’s suppose two classes one event and the other one GoogleCalendar.
class Event {
private $googleCalendar;
public function __construct() {
$this->googleCalendar = new GoogleCalendar();
$this->googleCalendar->set_event($this);
}
}
class GoogleCalendar {
private $event;
public function set_event(&$event) {
$this->event = $event;
}
}
So, when I access the event element of the GoogleCalendar class, it says the object do not exist. Where is the problem ?
Thanks in advance and let me know if anything is not clear !
Etienne NOEL
Object is automatically passed by reference, you don’t need the
&$eventas an argument.Here’s an example: