Post
#1
|
|
|
Grupa: Zarejestrowani Postów: 550 Pomógł: 9 Dołączył: 29.05.2009 Skąd: Ostrów Wielkopolski Ostrzeżenie: (0%)
|
Witam,
wyświetla mi wszystkie kolumny z tabelki prócz id. Musi to być jakis drobny problem. Daje kod, kotrollera, modelu, widoku. Kontroller:
Model:
Widok: Kod <h3>Users</h3> <table class="table"> <tr> <th>Id</th> <th>Name</th> <th>User ID/Email</th> <th> </th> </tr> <?php foreach ($users as $user) : ?> <tr> <td><?php echo $user->id?></td> <td><?php echo $this->escapeHtml($user->name);?></td> <td><?php echo $this->escapeHtml($user->email);?></td> <td> <a href="<?php echo $this->url('users/user-manager', array('action'=>'edit', 'id' => $user->id));?>">Edit</a> | <a href="<?php echo $this->url('users/user-manager', array('action'=>'delete', 'id' => $user->id));?>" onclick="return confirm('Are you sure?')">Delete</a> </td> </tr> <?php endforeach; ?> </table> Daj cie znać w czym problem. Ten post edytował cykcykacz 3.09.2013, 14:10:17 |
|
|
|
![]() |
Post
#2
|
|
|
Grupa: Zarejestrowani Postów: 550 Pomógł: 9 Dołączył: 29.05.2009 Skąd: Ostrów Wielkopolski Ostrzeżenie: (0%)
|
Od razu napiszę że rozwiązałem ten problem ale od razu powstał następny (IMG:style_emoticons/default/smile.gif) A więc czytajcie do końca (IMG:style_emoticons/default/smile.gif) .
Faktycznie w klasie user, w funkcji exchangeArray($data) brakowało id tak wyglądała przed:
Tak wyglądała po
I fajnie wyświetla mi dane z kolumny id. Oczywiście teraz chcę edytować i kasować rekordy z tabeli. Kasować mogę ale edytować nie (IMG:style_emoticons/default/sad.gif) Help me Edit Action
UserEditForm
Edit.phtml Kod <h3>Edit User Information</h3> <?php if ($this->error): ?> <p class="error"> There were one or more isues with your submission. Please correct them as indicated below. </p> <?php endif ?> <section> <?php $form = $this->form; $form->prepare(); $form->setAttribute('action', $this->url('users/user-manager', array('action' => 'process'))); $form->setAttribute('method', 'post'); echo $this->form()->openTag($form); ?> <dl class="zend_form"> <dt><?php echo $this->formLabel($form->get('name')); ?></dt> <?php echo $this->formElement($form->get('id')); ?> <dd><?php echo $this->formElement($form->get('name')); echo $this->formElementErrors($form->get('name')); ?></dd> <dt><?php echo $this->formLabel($form->get('email')); ?></dt> <dd><?php echo $this->formElement($form->get('email')); echo $this->formElementErrors($form->get('email')); ?></dd> <dd><?php echo $this->formElement($form->get('submit')); echo $this->formElementErrors($form->get('submit')); ?></dd> </dl> <?php echo $this->form()->closeTag() ?> </section> Po kliknięciu w Edit dostaję taki komunikat: Kod An error occurred An error occurred during execution; please try again later. Additional information: Zend\ServiceManager\Exception\ServiceNotFoundException File: C:\wamp\www\zend2book\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php:495 Message: Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for UserEditForm Stack trace: #0 C:\wamp\www\zend2book\module\Users\src\Users\Controller\UserManagerController.php(34): Zend\ServiceManager\ServiceManager->get('UserEditForm') #1 C:\wamp\www\zend2book\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractActionController.php(83): Users\Controller\UserManagerController->editAction() #2 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent)) #3 C:\wamp\www\zend2book\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent)) #4 C:\wamp\www\zend2book\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) #5 C:\wamp\www\zend2book\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractController.php(117): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) #6 C:\wamp\www\zend2book\vendor\zendframework\zendframework\library\Zend\Mvc\DispatchListener.php(114): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response)) #7 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent)) #8 C:\wamp\www\zend2book\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent)) #9 C:\wamp\www\zend2book\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) #10 C:\wamp\www\zend2book\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(309): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) #11 C:\wamp\www\zend2book\public\index.php(17): Zend\Mvc\Application->run() #12 {main} Nie wiem dlaczego? |
|
|
|
cykcykacz [inny][ZF2][ZendFramework2]Problem z wyświetleniem id. 3.09.2013, 14:08:36
buliq Nie rozumiem czegoś, używasz entity? bo w kodzie s... 3.09.2013, 14:19:37
cykcykacz To jest przykład z książki... 3.09.2013, 14:25:39
buliq hmm, ok, to pokaż mi klasę User, masz ją w kodzie ... 3.09.2013, 14:47:33
buliq Czy w konfiguracji modułu definiowałeś zasób UserE... 4.09.2013, 07:26:15
cykcykacz Dzięki już sobie poradziłem faktycznie nie miałem ... 4.09.2013, 13:25:11 ![]() ![]() |
|
Aktualny czas: 28.12.2025 - 17:08 |