First, edit your config/databases.yml and add : [yml] all: doctrine: class: sfDoctrineDatabase param: dsn: mysql:socket=/var/run/mysqld/mysqld.sock;dbname=mydb username: mydb password: mypassword encoding: utf8 attributes: default_table_collate: utf8_unicode_ci default_table_charset: utf8 Then open […]
Mot-clé - doctrine
Doctrine: Howto bypass the SoftDelete behaviour
For one of my projects I have to check if a record already exists in my database, deleted or not. The preDqlSelect looks like this : /** * Implement preDqlSelect() hook and add the deleted flag to all queries for which this model * is being used in. * * @param Doctrine_Event $event * @return void */ […]
Symfony: change the default type of your primary keys
Hey, yes it's possible to change the default type of your primary keys with a simple configuration Open your config/databases.yml. It should looks like this : [yml] # You can find more information about this file on the symfony website: # http://www.symfony-project.org/reference/1_4/en/07-Databases […]
[Symfony] Overwrite a value in a form
It happen sometimes that you have to set/override a value within a form but without using a hidden field (that can be overridden) Here is a short solution to set the user id in the object we are going to save. Let's say that we have an object PersonnalData linked to the sfGuardUserProfile In your […]
[Symfony] Load an sql dump within a task
I recently had a problem when loading fixtures in my symfony project. I was loading cities, about 37 000 of them, and the doctrine:data-load was extremly slow (about 5 minutes). I finally found a solution to load an sql dump wihtin a task, using the doctrine/default connection. With this solution, I […]
Display lastest dotclear posts in symfony
Here is a little tip to display the latest posts of your dotclear blog in your symfony website. Create a connection If your blog database is in an other database than symfony's one, you need to create a connection in the /config/databases.yml. Otherwise, skip this step Mine looks like this : [yml] […]