This is my first time to ask a question.
We have decided to systemize the management tables of rental services that Excel has managed.
As it is an internal project, I am thinking of implementing it in Symphony 4.
I'm having trouble handling the Form select box.
If you want to cover the entire database,
$builder
->add('article list',article list Type::class,[
'class' = > Item List::class
, 'choice_label' = > 'name'
])
- > Abbreviated below
It would be fine, but only those that can be lent out of them cannot be displayed on the select box.
The item list is linked to the rental list and OneToMany, and if you don't have a rental list, you can rent it.
I can add a method to the Repository in the list of items and return only the information of the items that can be lent, but how can I incorporate it into Foam?
I look forward to your kind cooperation.
I solved myself.
Instead of passing the data from outside, I added query_builder to get the result I wanted.
$builder
->add('article list',article list Type::class,[
'class' = > Item List::class
, 'choice_label' = > 'name'
, 'query_builder' = > function(EntityRepository$repository){
return$repository->createQueryBuilder('l')
->leftJoin ('l. Loan List', 'h')
->andWhere ('his null')
->orderBy('l.name', 'ASC');
}
Actually, I also specify labels, but I will write down the necessary parts.
© 2024 OneMinuteCode. All rights reserved.