mysqldoctrinesymfony-1.4doctrine-1.2

execute function on Database using doctrine and symfony


I have function on the database named getDtails(id) using CREATE FUNCTION on mysql

I can call it from mysql using SELECT getDetails(10) which return aninteger.

i want to execute it from symfony 1.4 using doctrine.


Solution

  • You could do it like this :

    Doctrine_Manager::getInstance()->getCurrentConnection()
           ->fetchAssoc('SELECT getDetails(10)');
    

    You can replace fetchAssoc with fetchArray or fetchBoth as required.

    Documentation of the Doctrine_Connection class is here