stoefln
stoefln

Reputation: 14556

Symfony2: using Facebook PHP Api, BaseFacebook class can not be loaded

I think this is related to the autoloading of Symfony2:

I created a

class FacebookSessionPersistence extends \BaseFacebook

Further, I inserted following line in the autoload.php:

$loader->registerPrefixes(array(
    'Facebook'         => __DIR__.'/../vendor/facebook/src',));

Still I get following error:

Fatal error: Class 'BaseFacebook' not found in /var/www/..../Bundle/Library/FacebookSessionPersistence.php on line 14

What should I do, to tell Symfony to load this class?

Upvotes: 0

Views: 2196

Answers (2)

Castro Roy
Castro Roy

Reputation: 7803

Check your autoload_classmap.php file, it should contain something like this

'BaseFacebook' => $vendorDir . '/facebook/php-sdk/src/base_facebook.php',
'Facebook' => $vendorDir . '/facebook/php-sdk/src/facebook.php',
'FacebookApiException' => $vendorDir . '/facebook/php-sdk/src/base_facebook.php',

if you installed the "facebook/php-sdk" with composer, it should be done automatically.

Upvotes: 0

Inoryy
Inoryy

Reputation: 8425

Try class FacebookSessionPersistence extends Facebook\BaseFacebook

If this fails you'll need to explicitly include base_facebook.php file

You should also take a look at FOSFacebookBundle - it probably solves whatever you're trying to do. At least I know for sure that it has a fos_facebook.api service, which is what you're trying to implement..

Upvotes: 1

Related Questions