Of course I have a backup!

Random blobs of wisdom about software development

A few years with Doctrine2

Thursday, June 26, 2014

I have been using Doctrine2 for about 3 years now. I started with the first 2.0 stable, integrating it into my employer's in-house framework, and in the last year, I have been using it as part of Symfony2. There are quite a few things that I love about it, and a small amount that I dislike.


Tagged as: | Comments (0)

Invalidating the OPcache in PHP 5.5

Saturday, October 19, 2013

The Zend Optimizer+ has been integrated into PHP core with the 5.5 release, which, according to the RFC page, has many advantages over APC. It has been renamed OPcache, can be enabled with a simple ini setting, and since it's in the core, it offers better version compatibility. Unfortunately it also includes my only gripe with APC, invalidating the cache is much harder than what one would think.


Tagged as: | Comments (7)

Get the ID of a related entity, without loading it in Doctrine2

Sunday, February 17, 2013

When using Doctrine, it very frequently happens that you have an entity in hand, an Article for example, that is in a many-to-one relationship with another entity (a Category), and you need to get the related entity's id. The problem is that Doctrine uses proxy objects for relationships, and when you access the id, the proxy will self-load itself, sending a query to the database. Shouldn't it be possible to get the related id, without another query? It's in the same table after all.


Tagged as: | Comments (0)

Getting a PHP app running on Heroku

Sunday, September 16, 2012

We were looking for an easy to set up hosting solution for our new PHP application. A colleague mentioned that we should try Heroku, since they are praised everywhere. I can agree, I don't even know what it is, but I have already seen it praised on various blogs.


Tagged as: | Comments (7)

PHP 5.4 is released

Sunday, March 04, 2012

The new major (or minor, if you look at version numbers) version of PHP has been released on March 1st, so here's the obligatory blog post on the new features. I'm only covering the parts that I think are important, this isn't a complete changelog.


Tagged as: | Comments (3)

What is Doctrine2 anyway

Monday, February 27, 2012

Doctrine2 is an ORM (Object relational mapper) library for PHP, and is one of the best things to happen to the PHP world, so far. The main point of an ORM is, to put it simply, to allow you to map PHP objects, to database tables. You can save and load your objects to/from the database, in a general way, that is, you don't need to write select/insert/update/delete SQL queries for them, because the ORM will take care of that for you.


Tagged as: | Comments (5)

Optimising a PHP site with KCacheGrind and XDebug

Saturday, December 10, 2011

We had a site that was expecting 100k+ unique visitors, but only for a single day. The motto of the site is "the day of internet shopping", basically, it is centered around having larger stores of all kinds, signing up, and making discounts, that are only valid for that single day only. I want to show some steps that we took to make sure that the website does not crash under the load.


Tagged as: | Comments (2)