To jest kod :
class Admin { protected function configureFormFields(FormMapper $formMapper) { ->add('name', 'text') ->add('product', 'entity', [ 'class' => 'AppBundle:Product', 'property_path' => 'name', 'multiple' => false, 'required' => false, 'empty_data' => null ]) ->end(); } } class Rabat { /** * @var * * @ORM\ManyToOne(targetEntity="product", inversedBy="rabats") * @ORM\JoinColumn(name="product_id", referencedColumnName="id", nullable=true) * */ protected $product = null; }
Problem polega na tym, że gdy dodam pole product jako sonata_type_model to wyświetla tylko label bez select boxa.
A kiedy ustawie te pole na typ entity, to nie mogę tego pola dodać jako null w formularzu admina i kiedy wybiorę jakis product to walidację przechodzi, ale w tabeli rabat pole product_id jest ustawione na null a w polu name jest ustawiane pole name z produktu.
Prosze o pomoc.