Showing entries 1 to 5
Displaying posts with tag: symfony (reset)
Symfony 2 and mysqlnd

In a previous blog posting I was mentioning that I'm working on a small hobby PHP project. As I'm using this project to update myself to current frameworks I've decided to use Symfony2. Symfony provides a nice feature, which is the Symfony Profilier, an extensive logging and reporting system for Symfony2 developers to understand what's going on. A part of it is the Doctrine query logger which lists all database queries executed by Doctrine and their execution time.

This is nice but when we're using mysqlnd in our PHP build we have more information available. "So why not use that information," I thought and built a new bundle for Symfony2 doing exactly that. The …

[Read more]
SQL Error with Symfony 1.4.4 and MySQL 5.5

I ran into an interesting bug/fact today while messing around with MySQL 5.5. It seems that in the DDL, you can’t say “Type=InnoDB|MyISAM|Foo” anymore. You have to say “Engine=InnoDB”.

This will break your propel:build-all , or propel:build-all-load .. or if you manually try to execute the sql from data/sql/*. You’ll get the following error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘Type=InnoDB’ at line 11

This issue is resolved in Propel 1.5.0, but I’m not sure when Symfony will include that in the Symfony 1.4 series.

To fix this issue, all you need to do is edit one file:

[Read more]
Changing MySQL storage engine for one table in your Propel/Symfony project

I need one MyISAM table in my schema, I’m using Symfony 1.2 and Propel 1.3. As flexible as Symfony and it’s YAML files are, Propel currently doesn’t allow you to change the storage engine on the fly. You use the storage engine as specified in propel.ini. As discussed in the Propel FAQ .

So, the next best thing to do now is to have it so that when Symfony runs propel:insert-sql, I can piggyback my own SQL to it. Luckily, this is possible, and it’s explained here

I now have my own SQL file running at the end, where I do an ALTER TABLE. For the lazy web.

1. Create your Alter table:

ALTER TABLE `database`.`footable` ENGINE=`MyISAM`;

2. Save the file in $projectdir/data/sql/piggyback.sql

[Read more]
Talking to multiple databases with Symfony 1.2

Notes on using Symfony with multiple databases.

I’m building a new application in symfony, and I need to use some data from an existing application written by another developer.

I can’t just extend the existing application for reasons we don’t need to get into, but I do need to interface with the data, since the existing
app doesn’t really have a nice way to handle a SOA, or share data easily, my next best option is to talk to the original app’s db.

Things you need to think about.

  1. No Hacks This is not a hack, symfony/propel support this out of the box, the documentation mentions it briefly but it’s definitely possible.
  2. Permissions Should you share the same username/password? or different? In my case, I wanted to make sure symfony couldn’t write to the existing app, so I created a user with SELECT privileges only. (This will affect your ability …
[Read more]
Symfony + MySQL to Django + PostgreSQL

While recently migrating from Symfony to Django plus changing the database backend from MySQL to PostgreSQL, there were mainly two tasks more time-consuming than I’ve had thought beforehand:

SQL dump

The old database used a latin1 encoding for the database fields and utf-8 as the server and client connection encoding. With these settings, even trying to get a correctly encoded database dump from phpMyAdmin is a bad idea.

Using mysqldump with an explicitly specified character-set is much better:

mysqldump ? ?default-character-set=latin1 …
[Read more]
Showing entries 1 to 5