在原则 2 中指定表类型/存储引擎
那么如何在原则 2 中指定用于给定实体的存储引擎呢?
我正在创建一个需要全文索引的表,并且只有 MyISAM 存储引擎支持 MySQL 中的全文索引。
另一方面:看起来 Doctrine 2 不支持开箱即用的全文索引?也没有全文搜索?这是正确的吗?
So how can one specify the storage engine to use for a given entity in Doctrine 2?
I'm creating a table that needs a full text index and only the MyISAM storage engine supports full text indexing in MySQL.
As a side: it looks like Doctrine 2 doesn't support full text indexing out of the box? Nor full text searches? Is that correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我晚了两年,但知道这一点很重要,因为由于某种原因它没有被记录下来,
我们一直在努力实现这一目标,但这就是解决方案
I'm two years too late, but knowing this is important since it isn't documented for some reason,
we have been struggling to achieve this but this is the solution
更新:
请参阅有关添加 "@Table(name="table_name",options={"engine"="MyISAM"})" 的评论,这是更好的答案。
======= 下面是原文 ===========
这是未经测试的代码,旨在帮助您找到答案,您需要阅读大量 Doctrine2 代码才能弄清楚您想要什么。我花了大约 30 分钟阅读代码,但找不到将 $options 数组通过 ORM 层推送到这个 DBAL 层函数的方法。
查看 Doctrine/DBAL/Platforms/MySQLPlatform.php
尝试硬编码 什么引擎想要在那里。它几乎肯定会破坏一些东西(例如,外键 不要在 MyISAM 中工作)
Update:
See the comment about adding "@Table(name="table_name",options={"engine"="MyISAM"})" , it is the better answer.
======= Original Below ===========
This is untested code aimed to help you get to an answer, you will need to read a lot of Doctrine2 code to figure out what you want though. I spent about 30mins reading code and couldnt find a way to push the $options array through the ORM layer to this DBAL layer function.
check out Doctrine/DBAL/Platforms/MySQLPlatform.php
try hard coding what engine want in there. It will almost certainly break stuff though (eg, foreign keys dont work in MyISAM)
如果您使用的是doctrine2迁移..
If you're using doctrine2 migrations ..