public function removeValue(EavValueCommon $value)
 {
     if (!isset($this->items[$value->getID()])) {
         return;
     }
     $this->removedItems[$value->getID()] = $this->items[$value->getID()];
     unset($this->items[$value->getID()]);
 }
Exemple #2
0
 public static function restoreInstance($className, ActiveRecordModel $owner, EavFieldCommon $field, EavValueCommon $value)
 {
     $inst = parent::getInstanceByID($className, array(call_user_func(array($className, 'getOwnerIDColumnName')) => $owner->getID(), call_user_func(array($className, 'getFieldIDColumnName')) => $field->getID(), call_user_func(array($className, 'getValueIDColumnName')) => $value->getID()));
     $inst->getValue()->set($value);
     $inst->resetModifiedStatus();
     return $inst;
 }
Exemple #3
0
 public function set(EavValueCommon $value)
 {
     if (!$value->getID()) {
         return;
     }
     // 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);
     }
 }