sami_ghname82 (2) [Avatar] Offline
#1
Hi,
I am beginning to develop with PHP and zendFramework . I have began to create project with different layers and make copy files examples one by one but when I run application in order to test I get an error message which require these files:

Fatal error: Class 'Places' not found in /Users/Sami/Sites/places/application/controllers/IndexController.php on line 17.

Class Places is a model and in the bootstrap file configration code for models is this:

$rootDir = dirname(dirname(__FILE__));
define('ROOT_DIR', $rootDir);
set_include_path(get_include_path() .
PATH_SEPARATOR . ROOT_DIR . '/library/' .
PATH_SEPARATOR . ROOT_DIR . '/application/models/');

But where I take this function "Zend/loader"? Do you help me in order to success this test?
But can't find this file in provide repository with examples.
Best regards,
Sami

Message was edited by:
sami_ghname82
akrabat (479) [Avatar] Offline
#2
Re: Example of Chap. 3 not found class Places
If you are trying to run the code directly, then make sure you are using Zend Framework version 1.5.

If this is your first exposure to ZF, then have a look at http://akrabat.com/zft

Regards,

Rob...
sami_ghname82 (2) [Avatar] Offline
#3
Re: Example of Chap. 3 not found class Places
Thanks but our company need to work in version 1.9.
Now i read the book Zend framework in action but this example not work and not find the Places.php model.

i change this code


// include 'Zend/Loader.php';
// Zend_Loader::registerAutoload();

to:
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace(ROOT_DIR . 'library');
wantime (1) [Avatar] Offline
#4
Re: Example of Chap. 3 not found class Places
i have the same problem with "no found class Places".

it works if you use following codes in bootstrap.php

require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->setFallbackAutoloader(true);
$loader->suppressNotFoundWarnings(false);