原则ORM定制列排序规则 [英] Doctrine ORM Custom Column Collation
问题描述
我正在Doctrine文档中设置自定义列排序规则:
I'm trying to set custom column collation as in Doctrine documentation:
- http://doctrine-dbal.readthedocs.org/en/latest/reference/schema-representation.html 和
- http: //doctrine-orm.readthedocs.org/en/latest/reference/annotations-reference.html
- http://doctrine-dbal.readthedocs.org/en/latest/reference/schema-representation.html and
- http://doctrine-orm.readthedocs.org/en/latest/reference/annotations-reference.html
使用
@ ORM\Column(name =body,type =string,length = 140,options = {customSchemaOptions= { collate=utf8mb4_unicode_ci}})
但是当我更新架构时,它总是返回到utf8_unicode_ci(手动设置时)例如)。任何想法?
but when I update the schema it always goes back to utf8_unicode_ci (when I set it manually for example). Any ideas?
推荐答案
如果您(或其他人)仍然需要,现在已添加,请参阅 http://doctrine-orm.readthedocs.org/en/latest/ reference / annotations-reference.html#annref-column
This has been added by now if you (or someone else) still need, see http://doctrine-orm.readthedocs.org/en/latest/reference/annotations-reference.html#annref-column
示例:
/**
* @var string
*
* @ORM\Column(type="string", length=64, nullable=false, options={"collation":"utf8_bin"})
*/
private $code;
现在,所有常用数据库驱动程序都支持。
This is supported by all common database drivers now.
这篇关于原则ORM定制列排序规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!