2018-07-18 11:35:27 -04:00
|
|
|
<?php declare(strict_types=1);
|
2017-11-09 11:53:01 -05:00
|
|
|
|
2018-02-14 16:42:39 -05:00
|
|
|
namespace App\Form;
|
2017-11-09 11:53:01 -05:00
|
|
|
|
2018-07-23 09:52:00 -04:00
|
|
|
use Symfony\Component\Form\{
|
|
|
|
AbstractType, FormBuilderInterface
|
|
|
|
};
|
|
|
|
use Symfony\Component\Form\Extension\Core\Type\{ChoiceType, MoneyType};
|
2018-01-03 16:35:10 -05:00
|
|
|
use Symfony\Component\OptionsResolver\Exception\AccessException;
|
2017-11-09 11:53:01 -05:00
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
|
|
|
2018-02-14 16:42:39 -05:00
|
|
|
use App\Entity\Camera;
|
2018-01-03 16:35:10 -05:00
|
|
|
|
2017-11-09 11:53:01 -05:00
|
|
|
class CameraType extends AbstractType
|
|
|
|
{
|
2018-01-03 16:35:10 -05:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
|
|
|
{
|
|
|
|
$builder->add('brand')
|
|
|
|
->add('type')
|
|
|
|
->add('isDigital')
|
|
|
|
->add('mount')
|
|
|
|
->add('model')
|
2018-07-23 09:52:00 -04:00
|
|
|
->add('filmFormat', ChoiceType::class, [
|
|
|
|
'choices' => [
|
|
|
|
'Small Format' => [
|
|
|
|
'35mm' => '135',
|
|
|
|
'110' => '110',
|
|
|
|
],
|
|
|
|
'Medium Format' => [
|
|
|
|
'120' => '120',
|
|
|
|
'127' => '127',
|
|
|
|
'620' => '620',
|
|
|
|
],
|
|
|
|
]
|
|
|
|
])
|
2018-01-03 16:35:10 -05:00
|
|
|
->add('cropFactor')
|
|
|
|
->add('serial')
|
2018-07-23 09:52:00 -04:00
|
|
|
->add('purchasePrice', MoneyType::class, [
|
|
|
|
'currency' => 'USD',
|
|
|
|
])
|
2018-01-03 16:35:10 -05:00
|
|
|
->add('batteryType')
|
|
|
|
->add('received')
|
|
|
|
->add('isWorking')
|
|
|
|
->add('formerlyOwned')
|
|
|
|
->add('notes');
|
|
|
|
}
|
2017-11-09 11:53:01 -05:00
|
|
|
|
2018-01-03 16:35:10 -05:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
* @throws AccessException
|
|
|
|
*/
|
|
|
|
public function configureOptions(OptionsResolver $resolver): void
|
|
|
|
{
|
|
|
|
$resolver->setDefaults(array(
|
|
|
|
'data_class' => Camera::class
|
|
|
|
));
|
|
|
|
}
|
2017-11-09 11:53:01 -05:00
|
|
|
|
2018-01-03 16:35:10 -05:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getBlockPrefix(): string
|
|
|
|
{
|
|
|
|
return 'camerabundle_camera';
|
|
|
|
}
|
2017-11-09 11:53:01 -05:00
|
|
|
}
|