Symfony

New chapters, old chapters

April 14, 2016
By

It’s been almost an year since my last post. As usual a lot of stuff happened. On the personal side my daughter is growing and making me a delighted father (she just started mumbling some words, I think this helps being so happy) On the professional side I quit my job as a PM...

Read more »

Behat, login and fixtures

January 30, 2014
By

I want to use behat for some of the  testing of a new project and I  found a thing that’s not so easy to implement: actual login without a registration form The project right now doesn’t have a proper registration form, so I cannot use the registration process, also I don’t want to be...

Read more »

Code coverage and libraries

January 15, 2014
By

Phpstorm defaults to computing code coverage reports for unit tests, bbut this can become an issue if you use big third party libraries. The solution is simple and is to blacklist library files in phpunit configuration You need to pay attention to a detail though: whitelist block (if present) overrides the blacklist one in...

Read more »

Symfony, commands and SwiftMailer

June 6, 2013
By

Symfony is a nice piece of software, but let’s admit it: it still has some rough edges The one I stumbled in today involves the sending of e-mails using SwiftMailer from within a Symfony Command Even if everything was correctly configured, the generated emails were not actually sent The problem was soved by configuring...

Read more »

Doctrine2, transactions and lazy-load

June 5, 2013
By

I stumbled in an issue using Doctrine2 transactions inside a Symfony2 app I’m currently developing I needed a transaction regarding a user property First attempt has been to retrieve the User object through public function someAction(Request $request){ $usr= $this->get('security.context')->getToken()->getUser(); $usr = $em->lock($usr, \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE); .... try{ $amount = $usr->getSomeProperty(); if($amount > $okValue){ $amount--; } $usr->setSomeProperty($amount);...

Read more »

Symfony2 e la rivoluzione

October 6, 2012
By

Nella mailing list dei soci del GRUSP si è fatto riferimento ad un post di Mario Donà su cosa sia Symfony dal punto di vista di un programmatore “ibrido”,  ibrido come peraltro una enorme parte di noi chi più chi meno (me compreso) In particolare mi sento di commentare su un punto che di fatto...

Read more »

Errori random di Symfony2

December 2, 2011
By

Oggi ho aggiornato i vendors ed è apparso un altro di quegli errori random di Symfony2: Catchable Fatal Error: Argument 1 passed to Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\DoctrineParamConverter::__construct() must be an instance of Doctrine\Common\Persistence\ManagerRegistry, instance of Symfony\Bundle\DoctrineBundle\Registry given, called in .../app/cache/dev/appDevDebugProjectContainer.php on line 1336 and defined in ..../vendor/bundles/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter/DoctrineParamConverter.php line 31 500 Internal Server Error - ErrorException Ho provato...

Read more »

Git tricks

October 18, 2011
By

Per chi come me usa git solo da riga di comando ci sono alcune configurazioni che possono venire comode: Possiamo aggiungere una colorazione a vari output di git, per esempio quando listiamo i branches o lo status ui = auto current = yellow reverse local = yellow remote = green [color...

Read more »

Doctrine Bugs

October 14, 2011
By

Ho appena perso mezzo pomeriggio per un bug di Doctrine: Se si definisce un’entità come estensione di un’altra e questa entità ha fra le sue proprietà un mapping ManyToOne (ma credo anche ManyToMany o OneToMany) Doctrine genera un sql bacato solo nel caso si usi DQL La cosa noiosa è che l’sql generato è...

Read more »