I am trying to setup a relationship that requires 2 columns to be referenced in my relationship definition.
I have a comments table that is used by many different models throughout the system and within the Comment table I reference masterobjectid - defining the ID of the model, and also masterobjectclass - defining the model that 'owns' this comment.
Ideally i would like to say the following:
$this->hasMany(array('id', 'ClassName'), 'Comment', array('masterobjectid', 'masterobjectclass'));
The first array element is the id of $this model and is mapped to 'masterobjectid' of the comments table. Then also the ClassName (which I would like to be able to give the value in the hasMany call if thats possible, and not reference a table column) is mapped to 'masterobjectclass'.
Is this possible, or if not is there a way to approach this sort of relation using the Phalcon methods?
Read in the docs 'You could also use arrays to define multiple fields in the relationship.' but unclear how to go about this: http://docs.phalconphp.com/en/latest/reference/models.html#defining-relationships