Symfony2是否有任何开源(或示例)代码可以使用多个参数过滤某些模型?在这个Trulia网页上可以看到我正在寻找的一个很好的例子.
http://www.trulia.com/for_sale/30000-1000000_price/10001_zip/
http://www.trulia.com/for_rent/Chicago,IL/#for_rent/Chicago,IL/0-500_price/wd,dw_amenities/sm_dogs_pets"
http://www.trulia.com/for_rent/Chicago,IL/#for_rent/Chicago,IL/400-500_price/wd,dw_amenities
http://www.trulia.com/for_rent/Chicago,IL/#for_rent/Chicago,IL/wd,dw_amenities"
http://www.trulia.com/for_rent/Chicago,IL/#for_rent/Chicago,IL/400p_price/dw,cs_amenities
http://www.trulia.com/for_rent/Chicago,IL/#for_rent/Chicago,IL/1p_beds/1p_baths/400p_price/dw,cs_amenities
请注意在单击表单时如何构建URL,我想是使用一个控制器来处理所有这些路由,它是如何完成的?我不认为它会将所有可能的路由重定向到特定的控制器(如下所示),也许某种动态路由?
/**
* @Route("/for_rent/{state}/{beds}_beds/{bath}_bath/{mix_price}-{max_price}_price /{amenities_list}
* @Route("/for_rent/{state}/{mix_price}-{max_price}_price/{amenities_list}
* @Route("/for_rent/{state}/{bath}_bath/{mix_price}-{max_price}_price/{amenities_list}
* @Route("/for_rent/{state}/{mix_price}_price/{amenities_list}
* @Route("/for_rent/{state}/{beds}_beds/{bath}_bath/{amenities_list}
* ........
*/
public function filterAction($state, $beds, $bath, $min_price, $max_price ....)
{
....
}
Run Code Online (Sandbox Code Playgroud)
谢谢.