code: public function getData()
      {
          $data = array();
          foreach ($this->fields as $key => $field) {
              if ($field instanceof Type\ForeignKey) { // foreign key exception
                  $data[$key] = $field->getRawValue();
              } else {
                  $data[$key] = $field->getValue();
              }
          }
  
          return $data;
      }
docs: Get data