Validating form without Doctrine Entity

See the Using a Form without a Class section — there is a subsection on validation, too. The answer is to setup the constraints yourself, and attach them to the individual fields. use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; $builder ->add(‘firstName’, ‘text’, array( ‘constraints’ => new Length(array(‘min’ => 3)), )) ->add(‘lastName’, ‘text’, array( ‘constraints’ => array( new NotBlank(), … Read more

Symfony 4: How to organize folder structure (namely, your business logic)

Conway’s law: organizations which design systems … are constrained to produce designs which are copies of the communication structures of these organizations. You should design your directory structure around how you organize work. If you or your colleagues work full-stack on per feature basis you should group your code per feature. It will make navigation … Read more

Symfony2: HTML inside translation message

Update 2 In such cases, I started to use like this: confirmed: Congrats %start_link%%username%%end_link%, your account is now activated Since separation of concerns is maintained, this way is strongly recommended. Update In YAML, I have used translations like this without any problem: trans.key: click <a href=”https://stackoverflow.com/questions/14891977/%url%”>here</a> to continue Although translations and design should be kept … Read more

Doctrine OneToOne incorrectly? generating a UNIQUE INDEX

If One organisation has Many Users and Many Users have One and only one organisation then it’s not a One-to-One association. One-to-One associations have to be unique. Your association is ManyToOne on the User side and OneToMany on the organisation side. User.php /** * @ManyToOne(targetEntity=”Organisation”) */ private $organisation; Organisation.php use Doctrine\Common\Collections\ArrayCollection; /** * @OneToMany(targetEntity=”User”, mappedBy=”organisation”) … Read more