Symfony在select中禁用了选项

时间:2016-09-25 17:43:50

标签: forms symfony doctrine

我在关系表中存在禁用选择选项的问题。我怎么能这样做?

/**
 * @ORM\ManyToMany(targetEntity="Status", inversedBy="orderWork")
 * @ORM\JoinTable(name="order_status",
 *      joinColumns={@ORM\JoinColumn(name="order_id", referencedColumnName="id")},
 *      inverseJoinColumns={@ORM\JoinColumn(name="status_id", referencedColumnName="id")}
 *      )
 */

private $status;

并以表格 - >

->add('status', EntityType::class, ['label' => 'Užsakymo būsena',
        'attr' => ['class' => 'form-control' ,'style' => 'margin-bottom:15px; width:250px; height:30px;'],
        'class' => 'AppBundle:Status',
        'query_builder' => function ($em) {
            return $em->createQueryBuilder('s')
                ->orderBy('s.id', 'ASC');
            },
    'choice_label' => 'name'])

0 个答案:

没有答案