Closures Articles

Building and Executing SQL Queries In Zend

April 8, 2014

<p>Whilst there are many ways for building and executing <!-- raw HTML omitted -->SQL<!-- raw HTML omitted --> queries in Zend Framework 2, the two that I usually use, and which are also used in the ZF2 manual, are <strong>closures</strong> and the selectWith function. <!-- raw HTML omitted -->I previously <!-- raw HTML omitted --><!-- raw HTML omitted -->wrote a three part series<!-- raw HTML omitted --><!-- raw HTML omitted -->, showing how to get started using the <!-- raw HTML omitted --><!-- raw HTML omitted -->\Zend\Db\Sql<!-- raw HTML omitted --><!-- raw HTML omitted --> classes with Zend Framework 2, but I didn’t cover how to actually <!-- raw HTML omitted --><!-- raw HTML omitted -->run them<!-- raw HTML omitted --><!-- raw HTML omitted -->. So in today’s tutorial, let’s do that.</p>

Make Module Configs Cacheable with the ZF2 Factory Interface

April 6, 2014

<p>For the longest time, I’ve been using closures in my Zend Framework 2 Modules <!-- raw HTML omitted -->Module<!-- raw HTML omitted --> class. I know they’re not always the best approach, but they’re not necessarily wrong either.</p> <p>But after <a href="http://www.masterzendframework.com/reviews/maximising-zend-framework-2-performance-phpuk14">reviewing Gary Hockin’s recent talk</a> at <!-- raw HTML omitted -->PHP<!-- raw HTML omitted --> Conference UK, I was reminded that outside of APC and OPCache, <strong>closures aren’t cacheable</strong>.</p>