示例#1
0
 /**
  * Selects option if it is not already selected.
  *
  * @param boolean $multiple Append this option to current selection.
  *
  * @return self
  * @throws SelectException When no SELECT element association defined.
  */
 public function select($multiple = false)
 {
     if (!$this->isSelected()) {
         if ($this->select === null) {
             throw new SelectException('No SELECT element association defined', SelectException::TYPE_UNBOUND_OPTION);
         }
         $this->select->getWrappedElement()->selectOption($this->getValue(), $multiple);
     }
     return $this;
 }