Model Relationships using Declared Model Method
mediaslave opened this issue · 1 comments
mediaslave commented
Something like:
class ApplicationCategory extends \Model{
/**
* Add rules for this model.
*
* @author
*/
public function init(){
$s = $this->schema();
$s->hasMany('qas')->method('findQuestionsAndAnswersByCategoryIdAndParticipantId', $this->category_id, $this->participant_id);
}
public function findQuestionsAndAnswersByCategoryIdAndParticipantId($category_id, $participant_id)
{
# code...
}
}
mediaslave commented
You should still be able to pass className so that it can build the relationship using a method from another model.