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 master_object_id - defining the ID of the model, and also master_object_class - defining the model that 'owns' this comment.
Ideally i would like to say the following:
$this->hasMany(array('id', 'ClassName'), 'Comment', array('master_object_id', 'master_object_class'));
The first array element is the id of $this model and is mapped to 'master_object_id' 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 'master_object_class'.
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.phalcon.io/en/latest/reference/models.html#defining-relationships