Hi,
Following directions from https://docs.espocrm.com/development/orm/, I do unrelate as follows in a Hook :
I verified by logging that the entities exist and that they are correclty related as I can see the corrects records ids when printing as follows
Even afterRelate Hooks are triggerred so I assume taht the unrelate is actually executed but for a reason, the entities remain related afterwards.
If I unrelate from frontend GUI in bottom panel, it works fine. But when I unrelate in backend as above, it does not work. Every other statement executed at the same time in my Hook are done properly. I don't have any error logged in backend logs nor in console.
Any help on what direction to search would be highly appreciated as I'm kind of stuck with this issue.
Thanks !
Following directions from https://docs.espocrm.com/development/orm/, I do unrelate as follows in a Hook :
PHP Code:
$entityManager
->getRDBRepository('Account')
->getRelation($account, 'opportunities')
->unrelate($opportunity);
PHP Code:
$opportunityCollection = $entityManager
->getRDBRepository('Account')
->getRelation($account, 'opportunities')
->limit(0, 10)
->find();
If I unrelate from frontend GUI in bottom panel, it works fine. But when I unrelate in backend as above, it does not work. Every other statement executed at the same time in my Hook are done properly. I don't have any error logged in backend logs nor in console.
Any help on what direction to search would be highly appreciated as I'm kind of stuck with this issue.
Thanks !
Comment