We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Creating a multi-column, many-to-many relationship

I'm attempting to create a multi-column, many-to-many relationship in Phalcon, but I'm getting a "Not supported" exception.

Is there a way around this?


    ['ss_session_id', 'revision_id'],
    ['child_id', 'revision_id'],
    ['parent_id', 'revision_id'],
    ['ss_stream_id', 'revision_id'],
        'params' => [
            'conditions' => 'child_type = :child: AND parent_type = :parent:',
            'bind' => [
                'child' => Linking::CHILD_TYPE_SESSION,
                'parent' => Linking::PARENT_TYPE_STREAM
        'alias' => 'Streams'


Not supported
#0 [internal function]: Phalcon\Mvc\Model\Manager->getRelationRecords(Object(Phalcon\Mvc\Model\Relation), NULL, Object(NewExpo\Models\SnapShot\Session), NULL)
#1 [internal function]: Phalcon\Mvc\Model->_getRelatedRecords('NewExpo\\Models\\...', 'getStreams', Array)
#2 C:\xampp64\htdocs\new-expo\app\models\SnapShot\Session.php(257): Phalcon\Mvc\Model->__call('getStreams', Array)
#3 C:\xampp64\htdocs\new-expo\app\models\SnapShot\Session.php(257): NewExpo\Models\SnapShot\Session->getStreams()
#4 C:\xampp64\htdocs\new-expo\app\plugins\ConferenceProgramme.php(67): NewExpo\Models\SnapShot\Session->getStream()
#5 C:\xampp64\htdocs\new-expo\app\controllers\ConferenceController.php(17): NewExpo\Plugins\ConferenceProgramme->build()
#6 [internal function]: NewExpo\Controllers\ConferenceController->euroSevenAction('en')
#7 [internal function]: Phalcon\Dispatcher->callActionMethod(Object(NewExpo\Controllers\ConferenceController), 'euroSevenAction', Array)
#8 [internal function]: Phalcon\Dispatcher->dispatch()
#9 C:\xampp64\htdocs\new-expo\public\index.php(24): Phalcon\Mvc\Application->handle()
#10 {main}

Let me know if you need to see any more code from the related models.

It may be possible that you can't make a many-to-many, multi-column relationship. If it says "Not supported", it's a situation the Phalcon developers are aware might be encountered, but for whatever reason have chosen not to support.

Maybe take a look in the GitHub repository and see if this issue has been raised there.