FriendsOfSymfony / FOSOAuthServerBundle

A server side OAuth2 Bundle for Symfony
1.09k stars 451 forks source link

MongoDB Schema generation missing data fields (Symfony 3) #404

Open createproblem opened 8 years ago

createproblem commented 8 years ago

Hello.

I followed the installation instruction and I'm stuck at the schema generation.

Here is my client:

namespace OAuthServerBundle\Document;

use FOS\OAuthServerBundle\Document\Client as BaseClient;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;

/**
 * @MongoDB\Document
 */
class Client extends BaseClient
{
    /**
     * @MongoDB\Id
     */
    protected $id;
}

After I'm generating and updating my database, I created a new Client. The new created client is incomplete. Here is the Document

{ 
    "_id" : ObjectId("56f3cc3310df424a220041a7"),
}

There are some fields missing... I cleared my cache and dropped my database.

AccessToken, AuthCode and RefreshToken have the same issue. Indices and data fields provided by FOSOAuthServerBundle Documents are not created.

Any ideas whats going on?

Thanks for help.

rufinus commented 8 years ago

same here, i just added the fields to the xml - create client commands adds the fields as needed, but on getting token it seems the client is missing the collection - but in mongo i see its there.

johnpancoast commented 8 years ago

@createproblem @rufinus I think the problem is in https://github.com/doctrine/DoctrineMongoDBBundle/issues/357. Since the expected mapping filename suffix changed in master branch, I think it's causing fos oauth's mapping files to not get loaded (since they use the old suffix).

One workaround I've found is to set composer to the commit right before the one referenced in that issue.

"doctrine/mongodb-odm-bundle": "dev-master#2058608e3cf0ac06187f140e2dda3f7aab3f8bc8"

If you use yaml or xml mapping files you might have to make sure their suffix is .mongodb.yml or .mongodb.xml respectively.

Obviously things may be a little shaky since the above bundle doesn't yet have a stable version that supports sf3.

Hope that helps.

cjgordon commented 8 years ago

Confirmed I also have this issue with Symfony 3.0.4 and FOSoAuthBundle. @johnpancoast suggestion works for me. Thanks for pro tip. Will watch doctrine/DoctrineMongoDBBundle#357 for long term fix.

johnpancoast commented 8 years ago

FYI https://github.com/doctrine/DoctrineMongoDBBundle/pull/361. The issue in mongo odm bundle looks like it's fixed.

The-Don-Himself commented 6 years ago

This issue is still present.