public function updateChoices(array $choices, $former_access_id) {
		if (empty($choices)) {
			return false;
		}

		$choices_changed = false;
		$old_choices = $this->getChoices();

		if (count($choices) != count($old_choices)) {
			$choices_changed = true;
		} else {
			$i = 0;
			foreach ($old_choices as $old_choice) {
				if ($old_choice->text != $choices[$i]) {
					$choices_changed = true;
				}
				$i += 1;
			}
		}

		if ($choices_changed) {
			$this->deleteVotes();
			$this->setChoices($choices);
		} else if ($former_access_id != $this->access_id) {
			$this->updateChoicesAccessID();
		}
		
		return $choices_changed;
	}
public function updateChoices(array $choices, $former_access_id) {
		if (empty($choices)) {
			return false;
		}

		$choices_changed = false;
		$old_choices = $this->getChoices();

		if (count($choices) != count($old_choices)) {
			$choices_changed = true;
		} else {
			$i = 0;
			foreach ($old_choices as $old_choice) {
				if ($old_choice->text != $choices[$i]) {
					$choices_changed = true;
				}
				$i += 1;
			}
		}

		if ($choices_changed) {
			$this->deleteVotes();
			$this->setChoices($choices);
		} else if ($former_access_id != $this->access_id) {
			$this->updateChoicesAccessID();
		}
		
		return $choices_changed;
	}
public function updateChoices ( array $ choices , $ former_access_id ) { if ( empty ( $ choices ) ) { return false ; } $ choices_changed = false ; $ old_choices = $ this -> getChoices ( ) ; if ( count ( $ choices ) != count ( $ old_choices ) ) { $ choices_changed = true ; } else { $ i = 0 ; foreach ( $ old_choices as $ old_choice ) { if ( $ old_choice -> text != $ choices [ $ i ] ) { $ choices_changed = true ; } $ i += 1 ; } } if ( $ choices_changed ) { $ this -> deleteVotes ( ) ; $ this -> setChoices ( $ choices ) ; } else if ( $ former_access_id != $ this -> access_id ) { $ this -> updateChoicesAccessID ( ) ; } return $ choices_changed ; }
Check for changes in poll choices on editing of a poll and update choices if necessary
If an update is necessary the existing votes get deleted and the vote counters get reset

@param array $choices
Check for changes in poll choices on editing of a poll and update choices if necessary If an update is necessary the existing votes get deleted and the vote counters get reset