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.

(Continued)

Tagged as: | Comments (0)

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.

(Continued)

Tagged as: | Comments (0)

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.

(Continued)

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.

(Continued)

Tagged as: | Comments (2)