Doctrine setSQLLogger in symfony

Finally I was able to connect to doctrine in symphony, this way:

# Doctrine Configuration
doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                    driver:   "%database_driver%"
                    host:     "%database_host%"
                    port:     "%database_port%"
                    dbname:   "%database_name%"
                    user:     "%database_user%"
                    password: "%database_password%"
                    charset:  UTF8
                    mapping_types:
                                  enum: string

    orm:
        auto_generate_proxy_classes: false
        proxy_namespace: Proxies
        proxy_dir: Proxies
        default_entity_manager: default # The first defined is used if not set
        entity_managers:
            default:
                    connection: default
                    mappings: # Required
                             ApplicationUserBundle:
                                   type: annotation
                    class_metadata_factory_name: Doctrine\ORM\Mapping\ClassMetadataFactory
                    dql:
                        datetime_functions:
                        UNIX_TIMESTAMP: DoctrineExtensions\Query\Mysql\UnixTimestamp

Now my question is that how to have this in config.yml?
$config->setSQLLogger(new Doctrine\DBAL\Logging\EchoSQLLogger());

I mean another way than this. As this is a $config method I guess that should be possible to have it in config.yml, but how?

I don’t understand why you need to do anything special at all. Doctrine queries are logged right out of the box.

http://tutorial.symblog.co.uk/_images/doctrine_2_toolbar_queries.jpg

I wasn’t aware of that! very nice! thank you!
Indeed starting with Symfony is a pain for newbies but after getting familiar slowly, I fall in love with symfony! :smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.