toHash() public method

Converts a $Value to a hash.
public toHash ( eZ\Publish\SPI\FieldType\Value $value ) : mixed
$value eZ\Publish\SPI\FieldType\Value
return mixed
Example #1
0
 /**
  * Converts a $Value to a hash.
  *
  * @param \eZ\Publish\Core\FieldType\BinaryFile\Value $value
  *
  * @return mixed
  */
 public function toHash(SPIValue $value)
 {
     if ($this->isEmptyValue($value)) {
         return null;
     }
     $hash = parent::toHash($value);
     $hash['downloadCount'] = $value->downloadCount;
     return $hash;
 }
Example #2
0
 /**
  * Converts a $Value to a hash.
  *
  * @param \eZ\Publish\Core\FieldType\Media\Value $value
  *
  * @return mixed
  */
 public function toHash(SPIValue $value)
 {
     if ($this->isEmptyValue($value)) {
         return null;
     }
     $hash = parent::toHash($value);
     $hash['hasController'] = $value->hasController;
     $hash['autoplay'] = $value->autoplay;
     $hash['loop'] = $value->loop;
     $hash['width'] = $value->width;
     $hash['height'] = $value->height;
     return $hash;
 }