DragonByte Tech
Well-known member
- Affected version
- 2.0.10
Given the following relation:
Running this code:
I would expect the resulting Finder to have
Proposed patch to \XF\Mvc\Entity\Manager:
PHP:
'Subscriptions' => [
'entity' => 'DBTech\Mail:Subscription',
'type' => self::TO_MANY,
'conditions' => 'mailing_list_id',
'key' => 'user_id',
'cascadeDelete' => true
],
PHP:
$mailingList->getRelationFinder('Subscriptions')
keyedBy
set.Proposed patch to \XF\Mvc\Entity\Manager:
Diff:
--- src/XF/Mvc/Entity/Manager.php 2018-09-11 19:49:57.000000000
+++ src/XF/Mvc/Entity/Manager.php 2018-10-03 12:29:38.000000000
@@ -443,12 +443,17 @@
foreach ((array)$relation['with'] AS $extraWith)
{
$finder->with($extraWith);
}
}
+ if (!empty($relation['key']))
+ {
+ $finder->keyedBy($relation['key']);
+ }
+
if (!empty($relation['order']))
{
$finder->setDefaultOrder($relation['order']);
}
if (!empty($relation['proxy']))