Others may not be able to follow the link to your question, soon, since the issue will be closed. So I will duplicate your question here.
I have model A which has a hasMany to another model B. Can I access model B public methods in A based on the relationship?
Class A extends Phalcon/Mvc/Model {
//Members
public $id;
//Methods
public function initialize() {
$this->hasMany('id', 'B', 'a_id');
}
public function display() {
$this->B->display();
}
}
Class B extends Phalcon/Mvc/Model {
//Members
public $a_id;
//Methods
public function initialize() {
$this->belongsTo('a_id', 'A', 'id');
}
public function display() {
echo "Class B's method";
}
}
I can do something similar in CakePHP using their ClassRegistry which is a repo for class objects, each with a key.