Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [ZF] zf2 Akrabat tutorial
cykcykacz
post
Post #1





Grupa: Zarejestrowani
Postów: 550
Pomógł: 9
Dołączył: 29.05.2009
Skąd: Ostrów Wielkopolski

Ostrzeżenie: (0%)
-----


Hej,
korzystam z tutka ze strony http://akrabat.com/wp-content/uploads/Gett...Framework-2.pdf .
Wprowadzam adres do przeglądarki:
http://zf2-tutorial.localhost/album
dostaję error:
Kod
Fatal error: Namespace declaration statement has to be the very first statement in the script in C:\wamp\www\zf2-tutorial\module\Album\src\Album\Model\AlbumTable.php on line 3


AlbumTable.php
  1. <?php
  2.  
  3. namespace Album\Model;
  4.  
  5. use Zend\Db\TableGateway\TableGateway,
  6. Zend\Db\Adapter\Adapter,
  7. Zend\Db\ResultSet\ResultSet;
  8.  
  9. class AlbumTable extends TableGateway
  10. {
  11. public function __construct(Adapter $adapter = null, $databaseSchema = null,
  12. ResultSet $selectResultPrototype = null)
  13. {
  14. return parent::__construct('album', $adapter, $databaseSchema,
  15. $selectResultPrototype);
  16. }
  17. public function fetchAll()
  18. {
  19. $resultSet = $this->select();
  20. return $resultSet;
  21. }
  22. public function getAlbum($id)
  23. {
  24. $id = (int) $id;
  25. $rowset = $this->select(array('id' => $id));
  26. $row = $rowset->current();
  27. if (!$row) {
  28. throw new \Exception("Could not find row $id");
  29. }
  30. return $row;
  31. }
  32. public function addAlbum($artist, $title)
  33. {
  34. $data = array(
  35. 'artist' => $artist,
  36. 'title' => $title,
  37. );
  38. $this->insert($data);
  39. }
  40. public function updateAlbum($id, $artist, $title)
  41. {
  42. $data = array(
  43. 'artist' => $artist,
  44. 'title' => $title,
  45. );
  46. $this->update($data, array('id' => $id));
  47. }
  48. public function deleteAlbum($id)
  49. {
  50. $this->delete(array('id' => $id));
  51. }
  52. }


Ok, rozwiązanie znalazłem https://github.com/FriendsOfSymfony/FOSFace...undle/issues/70

Ten post edytował cykcykacz 24.05.2012, 14:58:54
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 00:54