Symfony : multiple nested form constraints

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")
     * })
     */
    private $fkPersonne;
    
// second level 

    /**
     * @var Coordonnee
     *
     * @AssertValid
     *
     * @ORMManyToOne(targetEntity="Coordonnee", cascade={"persist"})
     * @ORMJoinColumn(name="fk_coordonnee", referencedColumnName="idcoordonnee", nullable=false)
    */
    private $fkCoordonnee;
    
// 3rd level

    /**
     * @var string|null
     *
     * @AssertNotBlank
     * @AssertLength(
     *      min = 10,
     *      max = 10,
     *      maxMessage = "La profession doit avoir au maximum {{ limit }} caratères",
     *      allowEmptyString = false
     * )
     *
     * @ORMColumn(name="telfixe", type="string", length=10, nullable=true)
     */
    private $telfixe;

If anyone has a solution?

thank you

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *