Loading lots of Entities using Doctrine

Every once in a while you run into a situation where you need to load a lot (think thousands, not hundreds) of Doctrine entities from the database. For example when you want to create an export file, or when you want to apply some logic to all of them. The problem when you try this using the default implementation of Doctrine EntityRepository::findAll() is that it will load all entities from the database at once, oftentimes causing an out of memory error.

There is a relatively easy solution to this, using a Generator.

Continue reading »

php, doctrine, memory

Setting up a multi-domain self-signed SSL certificate

Today I got annoyed by the fact that our development server was running everything over http while our production server was running everything over https. I was annoyed because every time I had to create a URL there had to be a condition in there to check which environment we’re on and whether to add an ‘s’ for https. It bloats the code, and it’s not even business logic, it’s a technical problem that shouldn’t be solved at the level we were solving it at.

We had thought about running everything locally over https before, but thought that we’d get the ‘This is probably not the site you are looking for!’ warning in Chrome every time we visited our development site. We didn’t think about any more and dismissed the idea.

Today I got the idea it should be possible to install an SSL certificate on my local machine (Windows 7) to say that I trust that certificate and that chrome shouldn’t bother me about it.

So I looked it up and indeed it’s quite easy to do once you know how.

Continue reading »

ssl, self-signed, windows, linux

Go-ing at the speed of light

For those of you that don’t know me, I’m pretty much a PHP guy. Have been for quite some time now, about 10 years. I’d like to think that I know most of what PHP has to offer, and am able to pretty much make it do anything I like. However, there is an itch. The things that attracted me to the language most when I started out, like loose typing and no need to compile the code, are now the things that irritate me. I have to be fair here, it doesn’t irritate me on a daily basis, but I do find myself going “Oh, here we go again…” a few times a week. And of course there is speed. Even though PHP has come a long way, it’s still really slow compared to other languages, especially the ones that are compiled (yes, we’ve got HipHop now, I know, but from what I read from the benchmarks even with HipHop we’re still a long way away from other languages).

Continue reading »

go