Exemplo n.º 1
0
 /**
  * Update a meta field.
  *
  * ## OPTIONS
  *
  * <id>
  * : The ID of the object.
  *
  * <key>
  * : The name of the meta field to update.
  *
  * [<value>]
  * : The new value. If ommited, the value is read from STDIN.
  *
  * [--format=<format>]
  * : The serialization format for the value. Default is plaintext.
  *
  * @alias set
  */
 public function update($args, $assoc_args)
 {
     list($object_id, $meta_key) = $args;
     $meta_value = \Terminus::get_value_from_arg_or_stdin($args, 2);
     $meta_value = \Terminus::read_value($meta_value, $assoc_args);
     $success = \update_metadata($this->meta_type, $object_id, $meta_key, $meta_value);
     if ($success) {
         \Terminus::success("Updated custom field.");
     } else {
         \Terminus::error("Failed to update custom field.");
     }
 }