summaryrefslogtreecommitdiffstats
path: root/codebase
diff options
context:
space:
mode:
authorKirylka <kirylanoshko@gmail.com>2015-04-08 11:30:43 +0300
committerKirylka <kirylanoshko@gmail.com>2015-04-08 11:30:43 +0300
commit97e6cc31625b9ec2f283ce0cc7a636584748406d (patch)
tree2b3f4b83d920a25767435d3a331e632e9646aa7b /codebase
parent53e93d10c99144344dda7c5a46e0abafd0a6a96f (diff)
downloadconnector-php-97e6cc31625b9ec2f283ce0cc7a636584748406d.zip
connector-php-97e6cc31625b9ec2f283ce0cc7a636584748406d.tar.gz
connector-php-97e6cc31625b9ec2f283ce0cc7a636584748406d.tar.bz2
fixes
Diffstat (limited to 'codebase')
-rw-r--r--codebase/DataStorage/PHPYii2DBDataWrapper.php31
1 files changed, 16 insertions, 15 deletions
diff --git a/codebase/DataStorage/PHPYii2DBDataWrapper.php b/codebase/DataStorage/PHPYii2DBDataWrapper.php
index 95af1b7..579dbbb 100644
--- a/codebase/DataStorage/PHPYii2DBDataWrapper.php
+++ b/codebase/DataStorage/PHPYii2DBDataWrapper.php
@@ -53,23 +53,24 @@ class PHPYii2DBDataWrapper extends ArrayDBDataWrapper {
protected function fill_model_and_save($obj, $data){
- //map data to model object
- for ($i=0; $i < sizeof($this->config->text); $i++){
- $step=$this->config->text[$i];
- $obj->setAttribute($step["name"], $data->get_value("c".$i)); //TODO make array with corresponding names
- }
+ $values = $data->get_data();
- if ($relation = $this->config->relation_id["db_name"])
- $obj->setAttribute($relation, $data->get_value($relation));
+ //map data to model object
+ for ($i=0; $i < sizeof($this->config->text); $i++){
+ $step=$this->config->text[$i];
+ $obj->setAttribute($step["name"], $data->get_value($step["name"]));
+ }
+ if ($relation = $this->config->relation_id["db_name"])
+ $obj->setAttribute($relation, $data->get_value($relation));
- //save model
- if ($obj->save()){
- $data->success();
- $data->set_new_id($obj->getPrimaryKey());
- } else {
- $data->set_response_attribute("details", $this->errors_to_string($obj->getErrors()));
- $data->invalid();
- }
+ //save model
+ if ($obj->save()){
+ $data->success();
+ $data->set_new_id($obj->getPrimaryKey());
+ } else {
+ $data->set_response_attribute("details", $this->errors_to_string($obj->getErrors()));
+ $data->invalid();
+ }
}
protected function errors_to_string($errors){