/** * Overloaded so that we can validate the value of best_of, * and re-calculate the wins_needed when it changes * * @ignore * {@inheritdoc} */ public function __set($name, $value) { //Make sure that when setting best_of, that it's a valid value if ($name == 'best_of') { $value = BBHelper::get_best_of($value); //Store directly into $data - if we reset, it'll be overwritten automatically $this->data['wins_needed'] = BBHelper::get_wins_needed($value); } //setting map_id - change map instead if ($name == 'map_id') { $name = 'map'; } //Let the default method handle the rest parent::__set($name, $value); }