我正在使用Symfony 1.4和Doctrine。
请允许我说,我有2个班级:品牌和产品。
When I create a new product in the Admin Generator based admin, I d like to choose a brand from a dropdown list.
The Admin Generator is doing that for me, automatically creating a sfWidgetFormDoctrineChoice
.
问题是,这些品牌是用id子订购的。 我喜欢由他们的“标签”领域命令他们。
为了做到这一点,我在我的ProductForm
类中进行了以下操作:
$this->widgetSchema[ brand_id ]->addOption( order_by , label );
但是我得到了以下错误:
Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near a at line 1. Failing Query: "SELECT b.id AS b__id, b.external_id AS b__external_id, b.label AS b__label, b.created_at AS b__created_at, b.updated_at AS b__updated_at FROM brand b ORDER BY l a"
排序语句真的很奇怪。我不明白为什么它似乎要截断排序语句的名称。
<><>Edit>: 很明显,按顺序排列的顺序是将一个阵列作为第二个参数。 它期望什么价值?