<?php
declare(strict_types=1);
namespace App\Form\Type;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CustomPartsType extends AbstractType
{
public function getParent(): string
{
return EntityType::class;
}
public function getName(): string
{
return $this->getBlockPrefix();
}
public function getBlockPrefix(): string
{
return 'custom_parts_js_field';
}
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['parts'] = $options['parts'];
$view->vars['partOwners'] = $options['partOwners'];
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setRequired(['parts']);
$resolver->setRequired(['partOwners']);
}
}