Exemplo n.º 1
0
 public function save(Gyuser_Model_User $User)
 {
     $data = array("client_type" => $User->getClient_type(), "first_name" => $User->getFirst_name(), "last_name" => $User->getLast_name(), "DNI" => $User->getDNI(), "CUIL" => $User->getCUIL(), "tel_cell" => $User->getTel_cell(), "tel_lab" => $User->getTel_lab(), "tel_otro" => $User->getTel_otro(), "tel_part" => $User->getTel_part(), "tel_lab_code" => $User->getTel_lab_code(), "tel_otro_code" => $User->getTel_otro_code(), "tel_part_code" => $User->getTel_part_code(), "email" => $User->getEmail(), "activity" => $User->getActivity(), "date_added" => $User->getDate_added(), "operator" => (int) $User->getOperator(), "contact_point" => $User->getContact_point(), "extra_info" => $User->getExtra_info(), "business" => $User->getBusiness(), "business_CUIT" => $User->getBusiness_CUIT(), "type_change" => $User->getType_change());
     if (null === ($id = $User->getId())) {
         unset($data['id']);
         $id = $this->getDbTable()->insert($data);
         if ($id) {
             $MultiAddressJson = $User->getMulti_address_json();
             $addressMapper = new Gyuser_Model_AddressDataMapper();
             $addresssJsonResult = $addressMapper->saveWithJson($MultiAddressJson, $id);
             $MultiPriorJson = $User->getMulti_prior_json();
             $priorMapper = new Gyuser_Model_PriorOperationsDataMapper();
             $PriorJsonResult = $priorMapper->saveWithJson($MultiPriorJson, $id);
         }
         return $id;
     } else {
         $id = $this->getDbTable()->update($data, array('id = ?' => $id));
         return $id;
     }
 }