/** * Since PHP doesn't allow overloading the constructor with a different parameter list, * we'll simply use a pseudo-constructor and call it init() * * @param BBTournament $tournament * @param boolean $add_to_parent True by default, try to add ourselves to the parent BBTournament * @return void */ public function init(BBTournament &$tournament, $add_to_parent = true) { $this->tournament =& $tournament; //Set parent so BBModel will auto flag changes $this->parent =& $this->tournament; //If not already being tracked, flag ourselves in the new tournament if ($add_to_parent) { if (is_array($teams =& $this->tournament->teams(false, null, true))) { if (!in_array($this, $teams)) { $this->tournament->add_team($this); } } } }