我有以下问题。我有2个在Manuttomany关系中的实体,我想为某个关键字序列进行排序。
team.php
/**
* @ORMManyToMany(targetEntity="DomainEntityPlayer")
* @ORMJoinTable(name="match_substitute_player_home")
*/
public $substitutePlayersHome;
现在,我将这些订购
/**
* @ORMManyToMany(targetEntity="DomainEntityPlayer")
* @ORMJoinTable(name="match_substitute_player_home")
* @ORMOrderBy({"FIELD(type, {'keep','def','atk'})"})
*/
public $substitutePlayersHome;
我的问题是如何将订单注释正确用于字符串值列表。
必须像这样的行,但是这一行不起作用:
* @ORMOrderBy({"FIELD(type, {'keep','def','atk'})"})
我的测试来源:
-> http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/ordered-associations.html
-> Propel Orm:通过字段订购
-> https://symfony.com/doc/current/doctrine.html
该字段属性在学说中未定义。下载并尝试此插件。https://github.com/beberlei/doctrineextensions
手动配置软件包:
doctrine:
orm:
dql:
string_functions:
field: DoctrineExtensionsQueryMysqlField