phalcon/cphalcon — pull request #2208 by maxgalbu (2014-03-20 00:13:45+00:00)
Title: criteria: fix issue #2157 and added tests

See the discussion here:
http://forum.phalconphp.com/discussion/1479/multiple-joins-in-oo-notation-fail

From what I saw, the problem was that the `current_joins` was merged with the `join` array instead of appended, so it resulted in something like this:

```php
array(
//first join
0 => array(
'type' => "LEFT",
'conditions' => "...",
),

//all the following joins
'type' => "LEFT",
'conditions' => "...",
)
```

This is my first attempt at editing phalcon code, I have some experience with c code but none with php extension. I didn't tried but i guessed I couldn't edit `current_joins` directly, so phalcon_array_append is out of the question. I don't know how to copy a zval, so to avoid editing too much code I simpy added an array of array that can be merged with `current_joins` or copy-writed on `merged_joins`.