Example #1
0
 /**
  * Metodo para actualizar un User en la base de datos
  * @param User $user Objeto User
  */
 public function update($user)
 {
     $this->validateBean($user);
     try {
         $data = $user->toArrayFor(array('id_person', 'id_access_role', 'username', 'password', 'status', 'notifications'));
         $data = array_filter($data, array($this, 'isNotNull'));
         $this->getDb()->update(User::TABLENAME, $data, "id_user = '******'");
         parent::update($user);
     } catch (\Exception $e) {
         $this->throwException("The User can't be saved \n", $e);
     }
 }
Example #2
0
 /**
  * Metodo para actualizar un Contact en la base de datos
  * @param Contact $contact Objeto Contact
  */
 public function update($contact)
 {
     $this->validateBean($contact);
     try {
         $data = $contact->toArrayFor(array('id_person', 'id_company', 'position'));
         $data = array_filter($data, array($this, 'isNotNull'));
         $this->getDb()->update(Contact::TABLENAME, $data, "id_contact = '{$contact->getIdContact()}'");
         parent::update($contact);
     } catch (\Exception $e) {
         $this->throwException("The Contact can't be saved \n", $e);
     }
 }