Le 31/03/2011 18:30, Donald a écrit :
Can anyone tell me how to use my custom function with Doctrine 2 in
Symfony 2?

Thanks,
Register the function throught the configuration:

doctrine:
    dbal: ~
    orm:
        entity_managers:
            default:
                mappings:
                    AcmeBlogBundle: ~
                dql:
                    string_functions:
test_string: Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestStringFunction
                    numeric_functions:
test_numeric: Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestNumericFunction
                    datetime_functions:
test_datetime: Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestDatetimeFunction

The above config will register 3 DQL functions named test_string, test_numeric and test_datetime

--
Christophe | Stof

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to