Category : constraints

I wrote custom constraint for my entity where I have startDate and endDate where I want to avoid overlapping when saving new ones. <?php namespace AppEntity; use DoctrineORMMapping as ORM; use AppValidatorConstraintsNotOverlapping; /** */ class Product { /** * @ORMId() * @ORMGeneratedValue() * @ORMColumn(type="integer") */ private $id; /** * @ORMColumn(type="date", nullable=false) */ private $startDate; /** ..

Read more

I’m using the ChoiceFieldMaskType from Sonata. I want to display some fields when one field true. Here’s what I’ve done: ->add(‘hasArtist’, ChoiceFieldMaskType::class, [ ‘label’ => ‘Mettre un artiste sur l’article?’, ‘choices’ => [ ‘Oui’ => ‘true’, ‘Non’ => ‘false’, ], ‘map’ => [ ‘true’ => [‘artistName’, ‘artistText’,’artistLink’,’artistImage’], ], ‘required’ => true ]) ->add(‘artistName’, TextType::class, [‘required’ ..

Read more

I try to put constraints in the entity on the 3rd nesting level of my form. But they don’t return errors. The first and second level are not a problem. // 1° level // firs level ///// /** * @var Personne * * @AssertValid * * @ORMManyToOne(targetEntity=”Personne”, cascade={“persist”}) * @ORMJoinColumns({ * @ORMJoinColumn(name=”fk_personne”, referencedColumnName=”idPersonne”) * }) ..

Read more