symfony

Doctrine EntityListener Pills: Comparing old and new values when updating data

You all, at some point, faced the necessity to compare old and new values when storing an entity. Here is where Doctrine EntityListener comes at help. Let imagine you have this User entity

and you want to notify the user when the email address has been changed. All you…

Uso del Page Object Pattern con Behat: esempio pratico

Il Page Object è un pattern utilizzato nei functional test per astrarre l’interazione con gli elementi della UI. All’interno di un oggetto vengono incapsulate le interazioni e le funzionalità di una pagina web che vengono esposte tramite api, nascondendo la struttura degli elementi HTML all’esterno. Per approfondire il concetto rimando…

Symfony form pills – form type options

Today we are going to tackle a problem that I’ve recently faced with Symfony form types. Scenario: I need a choice type of a certain entity (Foo) with values that follows a certain logic

I’ve built up a FooChoiceType because I don’t want to inject fooAdapter in each form where I’m…

Symfony form pills – Value object

Suppose that we have a value object or, more in general, an object where its data has been set in the constructor

and its FormType

Let’s assume that bar and foobar are taken from HTTP POST values (so, basically, we need those values to be posted in order to instantiate a Foo object). Question How can I create…

Assets versioning with Symfony and Capifony

Just a quick tip for assets versioning with Symfony2. Let’s imagine you have an asset, called “beautifulAsset.js”, in your app. As soon as it’s requested, the user browser caches it. So far so good. Problems arise when you change the code inside “beautifulAsset.js” and deploy your application. If you don’t…