Exemple #1
0
 public function set(EavValueCommon $value)
 {
     // test whether the value belongs to the same field
     if ($value->getField()->get()->getID() != $this->getField()->get()->getID()) {
         $class = get_class($value->getField()->get());
         throw new Exception('Cannot assign ' . $class . ':' . $value->getField()->get()->getID() . ' value to ' . $class . ':' . $this->getField()->get()->getID());
     }
     if ($value !== $this->getValue()->get()) {
         $this->getValue()->set($value);
     }
 }
 public function set(EavValueCommon $value)
 {
     // test whether the value belongs to the same field
     if ($value->getField()->get()->getID() != $this->fieldInstance->getID()) {
         $class = get_class($value->getField()->get());
         throw new Exception('Cannot assign ' . $class . ':' . $value->getField()->get()->getID() . ' value to ' . $class . ':' . $this->fieldInstance->getID());
     }
     if (!isset($this->items[$value->getID()])) {
         $item = call_user_func_array(array($this->getItemClassName(), 'getNewInstance'), array($this->ownerInstance, $this->fieldInstance, $value));
         $this->items[$value->getID()] = $item;
         unset($this->removedItems[$value->getID()]);
     }
 }
Exemple #3
0
 /**
  * Adds a 'choice' value to this field
  *
  * @param SpecFieldValue $value
  */
 public function addValue(EavValueCommon $value)
 {
     $value->getField()->set($this);
     $value->save();
 }