44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Form;
|
|
|
|
use App\Entity\OrderItem;
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
|
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
|
|
final class OrderItemFinalize extends AbstractType
|
|
{
|
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
|
{
|
|
$builder
|
|
->add(child: 'name', options: [
|
|
'label' => 'order item',
|
|
'disabled' => true,
|
|
])
|
|
->add(child: 'extras', options: [
|
|
'disabled' => true,
|
|
])
|
|
->add(child: 'createdBy', options: [
|
|
'disabled' => true,
|
|
])
|
|
->add(child: 'priceCents', type: MoneyType::class, options: [
|
|
'label' => 'price',
|
|
'divisor' => 100,
|
|
])
|
|
->add(child: 'isPaid', type: CheckboxType::class, options: [
|
|
'required' => false,
|
|
'label' => 'paid?',
|
|
])
|
|
;
|
|
}
|
|
|
|
public function configureOptions(OptionsResolver $resolver): void
|
|
{
|
|
$resolver->setDefaults([
|
|
'data_class' => OrderItem::class,
|
|
]);
|
|
}
|
|
}
|