所以我有一个搜索栏表单,我需要临时连接到一个遗留的非 symfony 页面。当前获取 url 如下所示(url-decoded)
http://localhost:9090/lagacy_page?query=test&platforms[]=Mac,Windows
但我需要使网址如下所示
http://localhost:9090/lagacy_page?query=test&platforms=Mac,Windows
Symfony 正在使平台成为一个数组,如果有办法强制它成为一个逗号分隔的列表,是否有人反对?
这是 buildForm 方法
/**
* method to build search bar form
*
* @param \Symfony\Component\Form\FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
// the platform selector
$builder->add('platform', 'choice',
['choices' => [
Platforms::ALL => 'All Software', // TODO: need to translate this
Platforms::WINDOWS => 'Windows',
Platforms::MAC => 'Mac',
Platforms::IOS => 'iOS',
Platforms::ANDROID => 'Android',
],
'multiple' => true,
'expanded' => true]);
// the actual search bar
$builder->add('query', 'search');
}