Le 08/05/2011 22:38, thesaint a écrit :
Hi,

I'm missing a tutorial in the cookbook on how to use 3rd party classes
that use neither namespaces nor prefixes.

In my case I'd like to use the Faker library (https://github.com/caius/
php-faker). It's just one class that loads its libraries if needed.

I have the following setup:

I've renamed faker.php to Faker.php and put it in vendor/faker/src

I try to initialize the library in my controller with

    $faker = new \Faker();

But I always get the Fatal error: Class 'Faker' not found error
message.

I've tried adding

   'Faker' =>  __DIR__.'/../vendor/faker/src'

to registerNamespaces in autoload.php, but that had no effect.

You should try to put it in registerPrefixes. This is not a namespaced class so putting it in registerNamespaces is wrong.

--
Christophe | Stof

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to