Doctrine not saving ManyToMany

Say you have a ManyToMany relationship, like Post <—> Tag.

When you add tags to a Post and the save the Post, everything is great. But when you add posts to a Tag and then save the Tag, the posts are not saved. Why? Because Doctrine persists changes only on the owning side of a relation. The owning side is…

Read More

Reduce number of queries

Customers often call me because their site is slow. One of the most common problems I found was a high number of queries that get executed for every single page hit. When I say a lot, I mean sometimes more than 1000 queries for a single page. This is often the case with a CMS…

Read More

Common PHP Mistakes

I was recently asked by one of my readers to give feedback on the following article he read: 10 Most Common PHP Mistakes. It is well written and very thorough. Most of the tips are specific to PHP, others are about web programming in general or database performance. It’s a very good read. I was also asked…

Read More

Brute-force countermeasures

Password brute-forcing refers to trying all password permutations until the attacker finds the right one. Here are some of the most common ways to mitigate that risk: Increase the length of the password. With every additional character, the number of permutations goes up exponentially. Say you use 26 letters and 7 characters. You’ll get 8 billion combinations. Increase that to 8 characters and…

Read More