Skip to main content

Symfony

Add an image field to an entity, using vichuploader
Symfony

The process of adding file uploads to an entity is documented in the Symfony cookbook. As one quickly notices, the default technique requires you to hard-code a file path within the entity, and copy-paste some dull code. The VichUploader Bundle (get it at github) moves required paths to the config.yml file and abstracts some of that code away. But you'll still need to mess about when you add an image or other uploadable item to your entity.

Overriding FOSUserBundle Forms in Symfony2
Symfony

It's relatively easy to customize FOSUserBundle behavior by creating your own child bundle, with FOSUserBundle as the parent. Once you've done this, you can provide your own registration and profile forms - as long as you remember all the small steps. This is intended first and foremost as a simple reminder of the steps involved. Code examples follow, but may or may not be exactly what you need. We will assume that you have created an MemberBundle, and declared it a child of FOSUserBundle. We'll demonstrate using the Registration form.

Subscribe to Symfony