Setting defaults on the database level makes a lot of sense to prevent the chance of issues arising in the application. Having the configuration for it in the Doctrine annotations makes things easier because you can also automatically generate migrations for it. In MySQL the keyword to use is DEFAULT.
I wanted to have translatable entities in my project. So I used Gedmo translatable through the doctrine extensions bundle for Symfony. When using any kind of entity repository, a listener automatically pulls the right translation according to the current locale (from request or the default one). This is a really
I'm persisting a field of type ArrayCollection to a MySQL database which contains only stings. The database field is of type=array in the ORM definition and of type TEXT in the database. /** * @var ArrayCollection * * @ORM\Column(name="currencies", type="array") */ private $currencies; When persisted the