Setup Doctrine 2 filters in Zend Framework 2

Scenario Doctrine filter is a very powerfull tool that can be used to add conditional clauses at SQL level into our Doctrine 2 engine. This means that filters constraints will affect DQL queries, collections, lazy loading, etc. How to setup and use filters in generic conditions is well explained in this article of official Doctrine documentation, but in a Zend Framework 2 project, the same operation is a bit different. [Read More]

ReCaptcha in Zend Framework 2 without Zend/Form

The problem Captcha is a very useful mechanism to avoid automated abuse of your sites and applications. In particular,reCAPTCHA is a Google powered service that offers a free and simple way to implement a captcha protection field in your forms or pages. Zend Framework 2 implements his own components to handle captcha and a specific one to handle reCAPTCHA service. At the moment, the ZF2 documentation is very usefull if you want to integrate a reCAPTCHA in your Zend/Form component, but lacks in describing how to use reCAPTCHA service component alone. [Read More]

Working with DateTime in Doctrine 2 and Zend Framework 2

The problem Storing datetimes can be a issue if servers and users of your application are distributed around the World and use different time zones. Each user want to work on datetimes in his specific time zone, servers automatically stores values in their time zone, etc. Storing data without operating right conversion will cause strange behaviours. The solution The solution is very simple: store all datetimes in UTC time zone and show to each user in his proper time zone. [Read More]

Switch to mobile, tablet, or other layout in Zend Framework 1.11

The problem We want to implement a method to completely switch layout of our Zend Framework application without loosing flexibility. The solution must give us the possibility of switching all layouts and the views of the controllers we want. Other’s solutions I found some solutions on the Web, but I decided to post this article because no one satisfies my needs. They all resort to ContextSwitch to handle views file names, but, in my applications, I just use ContextSwitch in some actions for other purpose, so I’m unable to apply them without restructure existing code. [Read More]