Saturday, 15 June 2013

php - Hide specific options in dropdown in symfony2 -


I have a form that has these three fields, so in the list, I do not need all the data in the dropdown, but Only a few. How to do this

  Public function buildForm (FormBuilderInterface $ manufacturer, array $ option) {$ manufacturer - & gt; Joint ('title') - & gt; Joint ('parent', 'unit' '(' class' => 'retail mapping board: catalog', 'property' => gt; 'title')) - & gt; Add ('catalogLevelId', 'unit', array ('class' = & gt; retail mappingbank: CatalogLevel', 'property' =>); - & gt; Add ('save', 'submit', array ('label' = & gt; 'submit')); }  

query builder can do this for you, have you already tried ?

  Use the theory \ ORM \ unit repository; - & gt; Add ('catalogLevelId', 'unit', array (..., 'query_builder' => function (unit replication $ er) {return $ er- & gt; createQueryBuilder ('c') - & gt; orderBy ( 'C.name', 'ASC');}))  

No comments:

Post a Comment