/**
  *
  * Get model properties as array.
  * return array
  */
 public function getData()
 {
     $data = array();
     $data['id'] = $this->model->id;
     $retrievableAttributes = static::resolveRetrievableAttributesByModel($this->model);
     foreach ($this->model->getAttributes($retrievableAttributes) as $attributeName => $notUsed) {
         $type = ModelAttributeToMixedArrayTypeUtil::getType($this->model, $attributeName);
         $adapterClassName = $type . 'RedBeanModelAttributeValueToArrayValueAdapter';
         if ($type != null && @class_exists($adapterClassName) && !($this->model->isRelation($attributeName) && $this->model->getRelationType($attributeName) != RedBeanModel::HAS_ONE)) {
             $adapter = new $adapterClassName($this->model, $attributeName);
             $adapter->resolveData($data);
         } elseif ($this->model->isOwnedRelation($attributeName) && ($this->model->getRelationType($attributeName) == RedBeanModel::HAS_ONE || $this->model->getRelationType($attributeName) == RedBeanModel::HAS_MANY_BELONGS_TO)) {
             if ($this->model->{$attributeName}->id > 0) {
                 $util = new ModelToArrayAdapter($this->model->{$attributeName});
                 $relatedData = $util->getData();
                 $data[$attributeName] = $relatedData;
             } else {
                 $data[$attributeName] = null;
             }
         } elseif ($this->model->isRelation($attributeName) && $this->model->getRelationType($attributeName) == RedBeanModel::HAS_ONE) {
             if ($this->model->{$attributeName}->id > 0) {
                 $data[$attributeName] = array('id' => $this->model->{$attributeName}->id);
             } else {
                 $data[$attributeName] = null;
             }
         }
     }
     return $data;
 }
 protected function getRedBeanModelAttributeValueToExportValueAdapterClassName($attributeName)
 {
     assert('is_string($attributeName)');
     $type = ModelAttributeToMixedArrayTypeUtil::getType($this->model, $attributeName);
     $adapterClassName = $type . 'RedBeanModelAttributeValueToExportValueAdapter';
     if ($type != null && @class_exists($adapterClassName)) {
         return $adapterClassName;
     }
 }