Hallo,
I am just fighting with a problem on relations in Models.
I have moved from the conventions changing the primary key.
$this->setTable(‘accounts’);
$this->setDisplayField(‘name’);
$this->setPrimaryKey(‘account_no’);
and
$this->hasMany(‘Costcenters’, [ ‘foreignKey’ => ‘account_no’, ]);
That works fine. The purpose is I have to avoid lots of new entries each new year. OK so far so good, but I need an additional relationship like:
$this->hasMany('Journals', [ 'foreignKey' => 'actAccount', ]);
which is containing the id of the related account.
Can I have both? I read the cookbook/Table Objects several times but have not found the way.
Thanks in advance