以下に示すように、「ユーザー」と「属性」という 2 つのドクトリン エンティティがあります。すべてのユーザーを取得し、属性タイプ = x の属性名で並べ替えるクエリを作成する必要があります。たとえば、すべてのユーザーを取得して、'役職' で並べ替えます。
SELECT u FROM User u JOIN u.attributes a ORDER BY a.name {something??} a.type = 'title'
class User {
/**
* @ManyToMany (targetEntity="Attribute", inversedBy="users", cascade={"persist"})
*
*/
private $attributes;
}
class Attribute {
/**
* @Column (type="string", length=255, unique=false, nullable=false, name="name")
* @FormElement (type="text")
* @type string
*/
protected $name;
/**
* @Column (type="string", unique=false, nullable=true, name="type")
* @type string
*/
private $type;
/**
* @Column (type="integer", length=11, unique=false, nullable=true, name="priority")
* @type integer
*/
private $priority;
/**
* @ManyToMany (targetEntity="User", mappedBy="attributes")
*/
private $users;
}