Example #1
0
 /**
  * Set metadata
  *
  * @param mixed $key   Data key
  * @param mixed $value Data value
  *
  * @return $this
  */
 public function setMetadata($key, $value)
 {
     $data = $this->metadata->getValue();
     $metadata = $this->encoder->decode($data);
     $metadata[$key] = $value;
     $data = $this->encoder->encode($metadata);
     $this->metadata->setValue($data);
     return $this;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function setValue($value)
 {
     if ($value === null) {
         $value = array();
     } elseif (!Value::isArray($value)) {
         throw new InvalidArgumentException(sprintf("Field set value has invalid type: '%s'", gettype($value)));
     }
     return parent::setValue($value);
 }