This seems simple, but I can't get it to work.
Order Model Init:
public function initialize()
{
$this->setSource("orders");
$this->hasOne("user_id", "User", "id");
$this->hasOne("account_id", "Account", "id");
$this->hasOne("order_type_id", "OrderType", "id");
$this->hasOne("id", "OrderDistribution","order_id");
$this->hasMany("id", "OrderDistributionAudience","order_id");
}
Getting the order:
public function getOrder() {
$this->order_type = $this->getOrderType();
$this->user = $this->getUser();
$this->account = $this->getAccount();
$this->order_distribution = $this->getOrderDistribution();
$this->audiences = $this->getOrderDistributionAudience();
return $this;
}
In this case, order_type, user, account, and order_distribution are all returned to the UI just fine. audiences is an empty object. if I change the hasMany relationship to hasOne for AudienceDistributionOrder, I get an object containing the first record. I would expect that hasMany would return an array of AudienceDistributionOrder objects, but it doesn't.