public function add_local_alternative($alt) { if ($this->get_type() == NelioABExperiment::HEADLINE_ALT_EXP) { $fake_post_id = -1; foreach ($this->get_alternatives() as $aux) { /** @var NelioABAlternative $aux */ if ($aux->get_value() <= $fake_post_id) { $fake_post_id = $aux->get_value() - 1; } } $alt->set_value($fake_post_id); } parent::add_local_alternative($alt); }
public function add_local_alternative($alt) { $fake_post_id = -1; foreach ($this->get_alternatives() as $aux) { /** @var NelioABHeadlineAlternative $aux */ $val = $aux->get_value(); if (isset($val['id']) && $val['id'] <= $fake_post_id) { $fake_post_id = $val['id'] - 1; } } $val = $alt->get_value(); $val['id'] = $fake_post_id; $alt->set_value($val); parent::add_local_alternative($alt); }