My data has a one-to-one relationship between a CourseAdd
model, and it's EventType
model. However, the data in those tables don't interact with each other - they both relate back to a row in the event
table.
I have created a many-to-many relationship like so:
$this->hasManyToMany(
'event_id',
'\Model\Event',
'id','type',
'\Model\EventType',
'name',
['alias'=>'Type']
);
This is successfully setting up the relationship, but the problem is that it's not set up as a single entity, but rather a collection. So in CourseAdd
, $this->Type
references a simple resultset. To reference the particular record, I have to go $this->Type[0]
.
Is there a way to set up a one-to-one relationship, but specifying it through an intermediary table? Looking at the Zephyr source code, it appears there are references to "has-one-through", but I don't see any subsequent methods to call.