Christopher Shennan’s Blog

A day in the life of…

Browsing Posts in Symfony

A few months ago I posted an article taking about how to get the raw SQL from a Doctrine Query Object but with the release of Symfony 1.3 and Symfony 1.4 it would appear that the code no longer works.  As a result I’ve updated the code to work with Symfony 1.2 – 1.4 and you can find the updated source below:-
continue reading…

Bookmark and Share

I am often importing data into a symfony project from an existing site or a CSV file and re-writing this data into the fixtures.yml is usually too complicated or time consuming so I end up writing bespoke import actions.

While I am writing these actions I often find that I have to delete the contents of the MySQL tables as you can never write the routine complete and accurate in one go so as you build it up in smaller steps you find that you have to get rid of the previously old data.

This presented me with 2 problems:-

  • Using DELETE FROM [TABLENAME] does not reset the auto-incrementing fields so if you have anything that is based on the id during the rest of the import then you’re going to have issues.
  • There is a lot of clicking in phpMyAdmin to empty the tables, especially if you forget about the foreign key relationships.

continue reading…

Bookmark and Share

This has been updated to work with Symfony 1.3/1.4 – Please go to the updated article: Raw SQL from Doctrine Query Object – Revised

As my use of Symfony is increasing I find myself frustrated that there doesn’t appear to be an easy way to get the raw SQL from a doctrine query object so I can simply output it and paste it into phpMyAdmin to debug problems with the SQL. I may be wrong about this but as yet I have not found a built in function to perform this operation.

Sure I am able to output the query with the “?” indicating where the necessary values are to go and I can also easily output the array of query parameters so I can substitute these manually but this takes time and it would be much much simpler and quicker to just output the whole query with the substitution already done so it’s a simply copy and paste of the raw SQL from the doctrine query object straight into phpMyAdmin.

I have wrote a quick function to do this and I had meant to post this for a while but I just have not had the chance to get round to it until now.
continue reading…

Bookmark and Share

How many times have you searched for the answer to a problem in Google to find nothing but forums with people who have the same questions but no solutions posted even though the question was raised months, even years earlier?

If you post a question and no-one managed to provide you with an answer do you:-

  • post up your solution when you’ve found it? or
  • simply forget about the post and leave everyone else to figure it out themselves too?

Unfortunately there are a number of people in the latter category (myself included from time to time) and being a web developer means I run into this type of issue more than I would like but, I’ve recently come across yet another great reason why you should go back and answer your own question when you have managed to work out the answer.
continue reading…

Bookmark and Share

Last week I was working away in the office at Line Digital on our latest Symfony based project when our project started giving us a strange error similar to:-

Fatal error: Uncaught exception ’sfConfigurationException’ with message ‘Configuration file "/usr/lib/php/symfony/config/config/core_compile.yml" does not have a registered handler.’ in /usr/lib/php/symfony/config/sfConfigCache.class.php:101

Looking into this a little closer we found that the server had ran out of disk space so after making some space and using “symfony cc” to clear the cache we thought that this would have resolved the problem, however we continued to get the “does not havea  registered handler” message being presented.

continue reading…

Bookmark and Share