for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* (c) Wessel Strengholt <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Usoft\IDealBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Usoft\IDealBundle\Model\Bank;
/**
* Class IDealType
* @author Wessel Strengholt <[email protected]>
class IDealType extends abstractType
{
* {@inheritdoc}
public function buildForm(FormBuilderInterface $builder, array $options)
$builder->add(
'banks', ChoiceType::class, array(
'choices' => $this->getBankList($options['data']),
'required' => true,
)
);
$builder->add('save', SubmitType::class, array());
}
* @param Bank[] $banks
* @return array
private function getBankList($banks)
$list = array();
foreach ($banks as $bank) {
$list[$bank->getName()] = $bank->getId();
return $list;