Witam
jest to moje pierwsze starcie z namespace w php oraz z ZF 2.0
mam folder /code w którym chciałbym trzymać klasy wykorzystywane w całej aplikacij
jest tam klasa User którą chcę wywołać w IndexController, niestety nie wiem co robię źle ponieważ dostaję komunikat
Kod
Fatal error: Class 'App\User' not found in /home/piotrek/workspace/cms/app/modules/default/controllers/IndexController.php on line 7


z góry dziękuje za pomoc smile.gif

mam taką strukturę plików


plik code/User.php

  1. namespace App;
  2.  
  3. class User {
  4. ...
  5. }


plik Bootstrap.php
  1. class Bootstrap extends Zend\Application\Bootstrap {
  2.  
  3. protected function _initAutoload()
  4. {
  5. $autoloader = new Zend\Application\Module\Autoloader(array(
  6. 'namespace' => '',
  7. 'basePath' => dirname(__FILE__),
  8. ));
  9. $autoloader -> clearResourceTypes();
  10. $autoloader->addResourceTypes(array(
  11. 'app' => array(
  12. 'namespace' => 'App',
  13. 'path' => 'code',
  14. )));
  15. return $autoloader;
  16. }
  17.  
  18. }


modules/default/controllers/IndexController.php
  1. class IndexController extends Zend\Controller\Action {
  2.  
  3. public function indexAction() {
  4. new App\User;
  5. }
  6.  
  7. }