php - Cannot access to my Propel's classes -


i have problem accessing propel's classes. example, try access livre class.

my code in index.php :

use biblio\biblio\livre; //load propel's autoload require 'vendor/autoload.php';  $collect = new livre(); $collect->setnom("aventure"); $collect->save(); 

and output error :

fatal error: class 'biblio\biblio\livre' not found in /applications/mamp/htdocs/propel/index.php on line 7

my classe livre in folder biblio/biblio/livre.php code, eclipse finds livre. when php executes, there error.

somebody have solution ?

you're going need add composer.json file (obviously modifying autoload data entire json file, rather appending as-is):

{   ...   "autoload": {     "classmap": ["biblio/"]   } } 

without this, require vendor/autoload.php; won't include propel classes , php won't able find namespace/class. don't forget run php composer dump-autoload command line update autoload.php file.


see propel documentation more information:

after generating classes, have autoload them.

or, learn more composer's autoloading:

for libraries specify autoload information, composer generates vendor/autoload.php file. can include file , autoloading free. [...] can add own code autoloader adding autoload field composer.json.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -