Search code examples
phpsymfony1doctrine

Doctrine findBy* methods and fetch array


What is the cleanest way of using the Doctrine findBy methods but getting an array returned and not objects.

Doctrine::getTable('Table')->findOneById(x);

That works but returns a doctrine object.

I'd still like to be able to use the find methods but I know I can't add

->fetchArray()

on the end.

Anyone else had this problem?


Solution

  • Try use toArray

    Doctrine::getTable('Table')->findOneById(x)->toArray();