JWTRefreshTokenBundle icon indicating copy to clipboard operation
JWTRefreshTokenBundle copied to clipboard

Support to doctrine/mongodb-odm-bundle 4.x still with errors

Open lcavero opened this issue 4 years ago • 14 comments

Hi, lookslike the new version 0.8 doesn't fix all errors. Now, when I require the library I get that:

The mapping file /xxx/vendor/gesdinet/jwt-refresh-token-bundle/Resources/config/mongodb/doctrine-document/RefreshToken.mongodb.xml is invalid:
!! Line 8:0: Element '{http://doctrine-project.org/schemas/odm/doctrine-mongo-
!! mapping}document', attribute 'repositoryClass': The attribute 'repositoryClass' is not allowed.
!!
!! Line 9:0: Element '{http://doctrine-project.org/schemas/odm/doctrine-mongo-
!! mapping}field', attribute 'fieldName': The attribute 'fieldName' is not allowed.

Thanks for updating the library so fast!

lcavero avatar Oct 10 '19 05:10 lcavero

@lcavero could you please test against dev-master , I fix xml mapping

markitosgv avatar Oct 10 '19 07:10 markitosgv

Hi, I really need this fix. When we can expect this amendment to be on the master?

pandresp avatar Oct 10 '19 08:10 pandresp

@pandresp could you please update to dev-master to test if this fix is working?

markitosgv avatar Oct 10 '19 08:10 markitosgv

@markitosgv on dev-master the previous error is not ocured, but new one exists I think.

Is the table name was changed? Base table or view not found: 1146 Table 'refresh_token' doesn't exist" Do you now something about this?

In data base I have table named as refresh_tokens with s on end. On version 0.7.1 working with refresh_tokens table.

pandresp avatar Oct 10 '19 08:10 pandresp

Yes, but look at this:

https://github.com/markitosgv/JWTRefreshTokenBundle/blob/40f03d12d8167f5fd1124ef9befb8ac3b07e1f87/Resources/config/mongodb/doctrine-document/RefreshToken.mongodb.xml#L8

Are you checking against last dev-master?

markitosgv avatar Oct 10 '19 09:10 markitosgv

@markitosgv Hi, testing in dev-master solves the previous problem, a new problem happens now

No identifier/primary key specified for Document 'Gesdinet\JWTRefreshTokenB
!! undle\Document\RefreshToken'. Every Document must have an identifier/primar
!! y key.
Ty

lcavero avatar Oct 10 '19 10:10 lcavero

Ok @lcavero

Could you please test changing line 9 of https://github.com/markitosgv/JWTRefreshTokenBundle/blob/40f03d12d8167f5fd1124ef9befb8ac3b07e1f87/Resources/config/mongodb/doctrine-document/RefreshToken.mongodb.xml#L9 to this:

<field field-name="id" type="id" id="true" />

markitosgv avatar Oct 10 '19 10:10 markitosgv

@markitosgv, I think you do not understand exactly my case

In my project I use postgres DB for entity (and for refresh tokens). In last days I ad hybrid configuration postgres + mongoDB And then problems was started.

For clear, I want use postgres DB to store my entities and refresh tokens. Only for some dokuments I use mongoDB.

I see that you switch configuration form yaml to xml After switch the configuration is not the same

Gesdinet\JWTRefreshTokenBundle\Entity\RefreshToken:
  type: entity
  table: refresh_tokens
  repositoryClass: Gesdinet\JWTRefreshTokenBundle\Entity\RefreshTokenRepository
<entity name="Gesdinet\JWTRefreshTokenBundle\Entity\RefreshToken">

shouldbe:

<entity name="Gesdinet\JWTRefreshTokenBundle\Entity\RefreshToken" table="refresh_tokens">

I think you forgot the table name

pandresp avatar Oct 10 '19 10:10 pandresp

You're right @pandresp , mistake was introduced in PR #167 . Solved in b05c321ccc24205966f90222307f1cc783d14dfa, f5472176b7599f0ea39c1b868d542cda722c33b3 and waiting for a new release when @lcavero confirms

markitosgv avatar Oct 10 '19 10:10 markitosgv

@markitosgv

The mapping file /home/luilli/FREELANCE/fly/core/vendor/gesdinet/jwt-refresh-token-bundle/Resources/config/mongodb/doctrine-document/RefreshToken.mongodb.xml is invalid:
Line 9:0: Element '{http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping}field', attribute 'id': The attribute 'id' is not allowed.

lcavero avatar Oct 10 '19 11:10 lcavero

Ok sorry @lcavero try this:

<id field-name="id" />

markitosgv avatar Oct 10 '19 11:10 markitosgv

Lookslike it works, no errors in cache clear. Great!

lcavero avatar Oct 10 '19 11:10 lcavero

Yes, it generates the refresh token on login. Perfect!

lcavero avatar Oct 10 '19 11:10 lcavero

@markitosgv Hola Marcos, no sé si me he perdido algo pero te cuento. Para doctrine odm 4 si no me equivoco tienen que haber dos cosas. El archivo RefreshToken.mongodb.xml tiene que estar como lo pusiste antes, con el campo , pero el archivo AbstractRefreshToken tiene que estar el tipo "datetime" cambiado a "date". He buscado en varias ramas del proyecto y en unas pone una cosa y en otras la otra, pero no las dos a la vez. Se me ha escapado a mí algo o hay algo mal? Creo que a lo mejor lo habéis vuelto a poner como datetime, porque yo llegué a probarlo y funcionaba. Saludos y muchas gracias por actualizar el proyecto

lcavero avatar Nov 02 '19 15:11 lcavero