Note that I’ve moved my own controller code out of the project folder and into the lib folder where it should be (in the smoc folder, some kind of play on the words Smarty and Doctrine).

So the above will output valid SQL I can just cop paste into phpMyAdmin and run. I prefer going from Model -> SQL since it’s faster and more comfortable just copy pasting PHP code than messing around in phpMyAdmin, especially when it comes to all the foreign keys and indexes when using InnoDB.