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.

QueryBuilder does not give desire results

$qBuilder = \Phalcon\Di::getDefault()->get('modelsManager')->createBuilder();

    $qBuilder
        ->columns('c.customer_id')
        ->addFrom(NS\Models\Customer', 'c');


    $records = $qBuilder->getQuery()
        ->execute()->toArray();
    $intermediate = $qBuilder->getQuery()->parse();
    $dialect      = \Phalcon\DI::getDefault()->get('db')->getDialect();
    //echo  $sql          = $dialect->select($intermediate);
     print_r($records);

     it always return 4 results.

     I printed the SQL "SELECT `c`.`customer_id` AS `customer_id` FROM `oc_customer` AS `c` ", it gives 1228 when I run in PHPMYADMIN

     Using phalcon 2.0.9, Xampp on window

     Appericiate if someone can give me any clue on that.


2.9k
Accepted
answer

All is working well, I was on wrong DB :-(