使用symfony2将mysql枚举迁移到原则实体的最佳策略? [英] Best strategy for migrating mysql enums to doctrine entities with symfony2?

查看:89
本文介绍了使用symfony2将mysql枚举迁移到原则实体的最佳策略?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在将一个遗留的应用程序迁移到symfony2,问题是我有很多mysql枚举列,我知道这个教义不支持枚举数据类型,一个解决方法是将它存储为字符串,但我真的会失去正确排序数据的能力,因为varchars慢了很多,我有很多表与枚举数据类型和修改模式将是非常困难的,我的选择是什么?你可以建议什么会使symfony2的转换更顺利?

解决方案

你有两个解决方案




  • 解决方案1:映射到Varchars

  • 解决方案2:定义类型



了解更多信息,请参阅以下链接: Mysql Enums doctrine


I am currently in the process of migrating a legacy app over to symfony2, the problem is that I have a lot of mysql enum columns, I know that doctrine does not support enum data types and that one workaround is to store as a string but I would really lose the ability to properly sort the data because varchars are a lot slower, I do have a lot of tables with the enum data types and modifying the schema would be really hard, what are my options?? What can you suggest that will make a transition to symfony2 a lot smoother?

解决方案

You have two solution

  • Solution 1: Mapping to Varchars
  • Solution 2: Defining a Type

for more information please consult this link: Mysql Enums doctrine

这篇关于使用symfony2将mysql枚举迁移到原则实体的最佳策略?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆