Hello! I'm using PHP Version 7.1.6, Phalcon Version 3.2.0.
I have a query:
$model = ComplainUser::query()
->columns([
'ComplainUser.*',
'UserWho.*',
'UserWhom.*',
])
->join('User', 'ComplainUser.who_id = UserWho.id', 'UserWho')
->join('User', 'ComplainUser.whom_id = UserWhom.id', 'UserWhom')
->orderBy('ComplainUser.date_add DESC')
->execute();
This is query result:
array (size=1)
0 =>
object(Phalcon\Mvc\Model\Row)[121]
public 'complainUser' =>
object(ComplainUser)[90]
public 'id' => string '5' (length=1)
public 'date_add' => string '2018-01-10 00:00:00' (length=19)
...
public 'UserWho' =>
object(User)[108]
public 'id' => string '1' (length=1)
public 'email' => string '[email protected]' (length=17)
...
public 'UserWhom' =>
object(User)[113]
public 'id' => string '2' (length=1)
public 'email' => string '[email protected]' (length=17)
...
It confuses me, that the first record has the key "complainUser", not "ComplainUser".
Is it an issue? I'd like to be sure that it will not cause problems in future (for example, if this behavior will be changed).
I know I can't set alias for my model in my query, so for now I'm going to make double check: both 'complainUser' and 'ComplainUser'.
Thank you for your responses.