We've just upgraded Phalcon to 3.1.1 from 2.0.13 and have found that the 'hasManyToMany' model relationships aren't working as they used to.
For example, our application allows accounts to have many users and users to have access to many accounts. So we have
user tables, joined by an
// In 'Account' model initialize() $this->hasMany('id', 'AccountUser', 'account_id', array('alias' => 'AccountUsers')); // In 'AccountUser' model initialize() $this->hasOne('account_id', 'Account', 'id', array('alias' => 'Account')); // In 'User' model initialize() $this->hasManyToMany('id', 'Model\User\AccountUser', 'user_id', 'account_id', 'Model\User\Account', 'id', array('alias' => 'Accounts'));
Before the upgrade, this would return an array of multiple accounts:
$accounts = $this->user->Accounts;
However, it now only returns one account (not in an array) as it would if we had used the
During the upgrade we've had to make changes to our model validation code, but haven't made any changes to how our relationships work. Is this a change in behaviour in the new Phalcon version, or are we missing something?