Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

PHQL Result Types

Is this possible to get resultsets similar to findFirst(), but using $this->modelsManager->executeQuery(some PHQL) ?? Now I'm selecting one row and I have to use foreach ($user as $u) { echo $u->email; } instead echo $user->email; to echo one email.



30.9k
Accepted
answer
edited Mar '14

Hi, try this:

class IndexController extends BaseController
{
    public function indexAction()
    {
        $phql = "SELECT * FROM Users WHERE id=1";
        $user = $this->modelsManager->executeQuery($phql)->getFirst();

        echo $user->email;
    }
}


17.3k

Thank you, that's it