fbpx

Tag php

PHP tip: array_diff an array of objects

That’s tricky! Let’s assume we have two arrays like these: [crayon-5f9064bd51315771750208/] Looking at these few lines I would expect that those two arrays are different but if we compare them with php array_diff function they’re the same: [crayon-5f9064bd5131a458011615/] This happens…

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 [crayon-5f9064bd524a4275045879/] and its FormType [crayon-5f9064bd524a7665514308/] Let’s assume that bar and foobar are taken from HTTP POST values (so, basically, we need those values to be posted…

Don’t rely entity setters (order)

What this code does? [crayon-5f9064bd5289f937745311/] It’s a simple class that represent a DateTimeInterval with a flag named allDayLong that let an object of DateTimeInterval class to fill all day. You can see that setFrom and setTo are affected from allDayLong flag: if is set, time of…