FOSOAuthServerBundle icon indicating copy to clipboard operation
FOSOAuthServerBundle copied to clipboard

Attempted to load class "BaseClient" from namespace "FOS\OAuthServerBundle\Propel\om" error message when using Guzzle

Open dimzerawww opened this issue 8 years ago • 7 comments

Hello,

I am opening this ticket because i'm getting an issue like #418 but i think it's an other problem.

I'm creating a user provider which needs to call an URL before returns an user. I use Guzzle to do that :

When i use a GuzzleClient which implements a ClientInterface (as Propel/Client.php implements a ClientInterface which is not the same, in your bundle), i'm getting this error message : Attempted to load class "BaseClient" from namespace "FOS\OAuthServerBundle\Propel\om". Did you forget a "use" statement for another namespace?

My config is clean, i use orm as db_drive in fos_oauth_server configuration and when i'm not using a GuzzleClient, i have no problem, my user provider works.

I have not been able to determine the source of the problem for the moment but i think there is a namespace conflict between these bundles.

dimzerawww avatar Nov 09 '16 10:11 dimzerawww

Got the same error, don't no where this comes from.

xoniq avatar Dec 14 '16 15:12 xoniq

I've got the same! How have I solve it:

  1. remove vendor/friendsofsymfony/oauth-server-bundle/Propel/*
  2. fix bugs in MY code
  3. test that everything works
  4. reinstall friendsofsymfony/oauth-server-bundle
  5. test that everything still works

GSokol avatar Dec 15 '16 11:12 GSokol

Thanks @GSokol !

This works. I deleted those files, and another exception came up which makes sense. I fixed the issues, removed vendor/friendsofsymfony/oauth-server-bundle and did a composer install.

xoniq avatar Dec 15 '16 12:12 xoniq

Old issue, but the solving process don't really work. Removing the vendor/friendsofsymfony/oauth-server-bundle/Propel/* and test that everything work generate the autoloader or container definition. Then you can restore the deleted path and it don't cause any more trouble because it doesn't try to reach again this folder. It can't work I you're trying to retrieve vendor during a build process (like travis or dockerization).

I've add a "exclude-from-classmap": ["**/oauth-server-bundle/Propel/**"] in the composer.json to have only warning. There's a similar issue on FOS/user-bundle where they're about to no longer support Propel.

ScullWM avatar Sep 07 '18 08:09 ScullWM

Encountering this same exact problem. Can anyone explain why this happens and how to properly solve it?

jorenvh1 avatar Feb 01 '19 13:02 jorenvh1

For me the same happened after requiring Guzzle in a Sylius-Project and initiate an instance of Guzzle/Client. Strange thing.

itinance avatar May 13 '19 08:05 itinance

@GSokol Thanks for the hint, I didn't get what you explained at first, so if it can help:

remove vendor/friendsofsymfony/oauth-server-bundle/Propel/*
fix bugs in MY code
test that everything works
reinstall friendsofsymfony/oauth-server-bundle
test that everything still works
  • remove vendor/friendsofsymfony/oauth-server-bundle/Propel/*
  • then re-execute the code triggering the issue
  • the error should be much more explicit of what is the root cause of this issue

ahocquard avatar Oct 21 '20 13:10 ahocquard