Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf8mb4_unicode_ci (mysql) #319

Open
jayesbe opened this issue Dec 25, 2015 · 12 comments
Open

utf8mb4_unicode_ci (mysql) #319

jayesbe opened this issue Dec 25, 2015 · 12 comments
Labels

Comments

@jayesbe
Copy link

jayesbe commented Dec 25, 2015

I am need of setting a length on the hash column in the Token entity.

In the Payum Core under Core/Bridge/Doctrine/Resources/mapping/Token.orm.xml

I need to add a length=191 on to the hash column. Whats the easiest way to override ?

I tried to extend the PayumBundle with MyOwnPayumBundle. I then tried to override the DI Extension class PayumExtension. Except that it wasn't finding the configuration tree. It seems I then need to override several other classes. Is there a better alternative ?

@makasim
Copy link
Member

makasim commented Jan 14, 2016

No need for the whole bundle. You have to add a listener and listen to load class metadata event.There you will be able to adjust the field parameters.

@makasim makasim closed this as completed Jan 14, 2016
@jayesbe
Copy link
Author

jayesbe commented Jan 17, 2016

Actually I only had to use @attributeOverride :)

@The-Don-Himself
Copy link

@attributeOverride is definitely the way to go but it will affect Doctrine's generate entity command, I think this really should be handled in this bundle's model class and as such this issue should be re-opened for further discussion.

@makasim
Copy link
Member

makasim commented Feb 9, 2017

You can always create your own model that implements interface and define fields mapping as you'd like.

@jayesbe
Copy link
Author

jayesbe commented Feb 9, 2017

Wow old ticket, in any case.. @attributeOverride worked perfect.. I would expect doctrine's generate entity command to be affected. I've had to do this with other bundles as well and has worked without exception for the moment.

@The-Don-Himself
Copy link

@jayesbe Indeed @attributeOverride works, I have also encountered this issue in FOSOauthServerBundle as well and the override works there as well.

I think the issue is that these are only temporary solutions in my view and should be catered for in the bundle like FOSUserBundle did after many people ran into it.

FriendsOfSymfony/FOSUserBundle#1919

Symfony docs have recommended utf8mb4 for about a year and a half now, this issue makes PayumBundle incompatible out of the box without @OverRide.

@makasim maybe if you don't want to change the length would you consider a mention in the docs? I can make a PR for either if you want.

@kirtixs
Copy link

kirtixs commented May 11, 2017

We are facing the same Issue but somehow @AttributeOverride does not work, we tried it on two different systems where we first deleted the cache folder completely.

@The-Don-Himself are you still willing to submit a PR for this Issue?

@makasim
Copy link
Member

makasim commented May 11, 2017

You can always create your own model that implements the interface and define fields mapping as you'd like.

This is still the valid case. There is no need to use models from the bundle you can create your own with required doctrine settings.

@kirtixs
Copy link

kirtixs commented May 11, 2017

Okay, we'll do that, but it's still weird that the default setup is broken.

@The-Don-Himself
Copy link

@redshark1802 I am willing to submit a PR for this because the changes required are really simple, maybe 15secs only but project owner @makasim has opted the community follow a different route which is his prerogative anyway and to be honest is equally simple with the bonus of learning a little bit more about Doctrine entities.

If your still having an issue, paste your entities and error and we'll help. For you're specific issue,my suspicion is that you have configured doctrine to cache metadata either in redis or apc hence deleting the cache folder wont help but either clearing redis from cli (nuclear option) of restarting apache (another nuclear option) but thae best is to run this command

php bin/console doctrine:cache:clear-metadata --env=prod

or

php bin/console doctrine:cache:clear-metadata --env=dev

@makasim
Copy link
Member

makasim commented May 12, 2017

@The-Don-Himself Don't get me wrong. I do not against the change and I see reasons behind it. The problem is such a change is a huge BC break and we simply cannot do it without bumping the major version.

We could think of other solutions, for example, we can add a new base model with a new metadata class for it.

@The-Don-Himself
Copy link

@makasim yes you're right, I keep forgetting that some changes, no matter how small will cause BC breaks. Perhaps just add it to the 3.x timeline and anyone who needs help can always follow this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants