potrzebuje zrobić akcje update rekordów z bazy za pośrednictwem formularza (edycja danych usera):

generalnie z samym update sobie poradziłem - problem tylko w tym jak przed update pobrać dane z bazy i wstawić je do inputa, aby user wiedział co modyfikuje..

i męczę się z tą akcją..

  1. public function updateAction()
  2. {
  3. $auth = Zend_Auth::getInstance();
  4. if (!$auth->hasIdentity()) {
  5. return $this->_redirect('brak-autoryzacji');
  6. }
  7. $this->view->identity = $auth->getIdentity();
  8. $this->view->form = new Application_Form_Edituser();
  9.  
  10. $User = new Application_Model_DbTable_User();
  11. $select = $User->select()->where('username = ?', $auth->getIdentity());
  12. $u = $User->fetchRow($select);
  13.  
  14. }


sam formularz do testów to wygląda po prostu tak:

  1. <?php
  2.  
  3. class Application_Form_Edituser extends Zend_Form
  4. {
  5.  
  6. public function init()
  7. {
  8. $view = Zend_Layout::getMvcInstance()->getView();
  9.  
  10. $this->setAction('zmien-dane-con');
  11.  
  12. $this->setMethod('post');
  13. $this->addElement('text', 'email', array('label' => 'Email'));
  14. $this->addElement('submit', 'submit', array('label' => 'Zapisz'));
  15. }
  16.  
  17.  
  18. }
  19.  
  20.  


potrzebuje tylko sposobu na pobranie danych z bazy i wyświetlenie ich przed aktualizacją..


//niekatualne - poradziłem sobie..

  1. $this->view->form->populate($u ->toArray());