Phalcon 2.0 - Phalcon\Mvc\Model\Query Issue With Joins

Hi,

I am in the process of upgrading from Phalcon 1.3.5 to Phalcon 2.0.0. Most of the process was fine, but I came across a blocker with Phalcon\Mvc\Model\Query.

https://gist.github.com/rkeplin/14d7c86a653f5ce3f7fe

In TestController.php, there are three queries. The second query always returns false while the first and third always returns true.

I am able to reproduce this issue against the 2.0.0 branch, and also the 2.0.0 tag. I cannot reproduce the issue against the 1.3.5 branch.

Am I doing something incorrectly with the Query builder?

Thanks

Could you please post this on Github?



4.1k
edited Apr '15

Have you tried changing

->columns('Office., Address.')

to this:

->columns(['Office.', 'Address.'])

In the Query Builder Docs the examples show a string being used as the paramter only when a single column parameter (including "*") is requested. When multiple column parameters are requested, it uses an array of columns.

Examples:

// 'SELECT * FROM Robots';
$phql = $builder->columns('*')
                ->from('Robots');

// 'SELECT id FROM Robots';
$builder->columns('id')
        ->from('Robots');

// 'SELECT id, name FROM Robots';
$builder->columns(array('id', 'name'))
        ->from('Robots');


1.1k

Yes, I have tried that. Supplying the columns as an array of fields results in the same behavior.