protected function convertValueFromStorage($valueName, $value) {
    // filter values according to type
    if ($this->hasAttribute($valueName)) {
      $type = $this->getAttribute($valueName)->getType();
      // integer
      if (strpos(strtolower($type), 'int') === 0) {
        $value = (strlen($value) == 0) ? null : intval($value);
      }
    }
    return $value;
  }