Horde_Kolab_Server_Object_Attribute_Value::update PHP Méthode

update() public méthode

Return the new internal state for this attribute.
public update ( array $changes ) : array
$changes array The object data that should be updated.
Résultat array The resulting internal state.
    public function update(array $changes)
    {
        if (!$this->isEmpty($changes)) {
            $value = $changes[$this->name];
            if (!is_array($value)) {
                $value = array($value);
            }
            return $this->attribute->update($value);
        }
        try {
            $old = $this->attribute->value();
            return $this->attribute->update(array());
        } catch (Horde_Kolab_Server_Exception_Novalue $e) {
            return array();
        }
    }

Usage Example

Exemple #1
0
 /**
  * Return the new internal state for this attribute.
  *
  * @param array $changes The object data that should be updated.
  *
  * @return array The resulting internal state.
  *
  * @throws Horde_Kolab_Server_Exception If storing the value failed.
  */
 public function update(array $changes)
 {
     $changes = parent::update($changes);
     if (!empty($changes)) {
         throw new Horde_Kolab_Server_Exception(sprintf("The value for \"%s\" may not be modified!", $this->_name));
     }
     return $changes;
 }
All Usage Examples Of Horde_Kolab_Server_Object_Attribute_Value::update
Horde_Kolab_Server_Object_Attribute_Value