You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also if you switch "MasterRobot" and "PeasantRobot" in createBuilder columns array, then returned data under the key "PeasentRobot" containts MasterRobot values:
class Robots extends Model
{
public$id;
public$name;
publicfunctioninitialize() {
$this->hasMany('id', 'Jobs', 'master_robot_id');
$this->hasMany('id', 'Jobs', 'peasant_robot_id');
}
}
Jobs model:
class Jobs extends Model
{
public$id;
public$master_robot_id;
public$peasant_robot_id;
publicfunctioninitialize() {
$this->belongsTo('master_robot_id', 'Robots', 'id', array('alias' => 'MasterRobot'));
$this->belongsTo('peasant_robot_id', 'Robots', 'id', array('alias' => 'PeasantRobot'));
}
}
Problem persists either relations are or aren't defined. Same thing happens when model aliases are present in relation definitions.
Tried in versions 1.2.4 and 1.3.0.
Update
Same thing with this:
$di = \Phalcon\DI::getDefault();
$mgr = $di->get('modelsManager');
$phql = " SELECT Jobs.*, MasterRobot.*, PeasantRobot.* FROM Jobs AS Jobs LEFT JOIN Robots AS MasterRobot ON MasterRobot.id = Jobs.master_robot_id LEFT JOIN Robots AS PeasantRobot ON PeasantRobot.id = Jobs.peasant_robot_id";
$mgr->executeQuery($phql);
QueryBuilder maps and returns data only from the last join:
Generated query:
You can see that MasterRobot columns are missing from SELECT block.
Returned data contains only PeasentRobot values:
Also if you switch "MasterRobot" and "PeasantRobot" in createBuilder columns array, then returned data under the key "PeasentRobot" containts MasterRobot values:
Robots model:
Jobs model:
Problem persists either relations are or aren't defined. Same thing happens when model aliases are present in relation definitions.
Tried in versions 1.2.4 and 1.3.0.
Update
Same thing with this:
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: