Skip to content

Commit a11bc2d

Browse files
author
Avikarsha Saha
committed
Merge branch 'MAUT-11460' into development
2 parents e14ca21 + 049eff4 commit a11bc2d

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

Config/config.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@
868868
'mautic.campaign.model.event',
869869
'event_dispatcher',
870870
'custom_object.helper.token_formatter',
871+
'%mautic.custom_item_fetch_limit_per_lead%',
871872
],
872873
],
873874
'custom_object.segments.decorator_delegate.subscriber' => [
@@ -1189,10 +1190,11 @@
11891190
],
11901191
],
11911192
'parameters' => [
1192-
ConfigProvider::CONFIG_PARAM_ENABLED => true,
1193-
ConfigProvider::CONFIG_PARAM_ITEM_VALUE_TO_CONTACT_RELATION_LIMIT => ConfigProvider::CONFIG_PARAM_ITEM_VALUE_TO_CONTACT_RELATION_DEFAULT_LIMIT,
1194-
'custom_item_export_dir' => '%kernel.root_dir%/../media/files/temp',
1195-
'custom_object_merge_filter' => false,
1193+
ConfigProvider::CONFIG_PARAM_ENABLED => true,
1194+
ConfigProvider::CONFIG_PARAM_ITEM_VALUE_TO_CONTACT_RELATION_LIMIT => ConfigProvider::CONFIG_PARAM_ITEM_VALUE_TO_CONTACT_RELATION_DEFAULT_LIMIT,
1195+
'custom_item_export_dir' => '%kernel.root_dir%/../media/files/temp',
1196+
'custom_object_merge_filter' => false,
1197+
'custom_item_fetch_limit_per_lead' => 15,
11961198
],
11971199
];
11981200

EventListener/TokenSubscriber.php

+19-12
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ class TokenSubscriber implements EventSubscriberInterface
9898
*/
9999
private $tokenFormatter;
100100

101+
/**
102+
* @var int
103+
*/
104+
private $leadCustomItemFetchLimit;
105+
101106
public function __construct(
102107
ConfigProvider $configProvider,
103108
QueryFilterHelper $queryFilterHelper,
@@ -108,18 +113,20 @@ public function __construct(
108113
TokenParser $tokenParser,
109114
EventModel $eventModel,
110115
EventDispatcherInterface $eventDispatcher,
111-
TokenFormatter $tokenFormatter
116+
TokenFormatter $tokenFormatter,
117+
int $leadCustomItemFetchLimit
112118
) {
113-
$this->configProvider = $configProvider;
114-
$this->queryFilterHelper = $queryFilterHelper;
115-
$this->queryFilterFactory = $queryFilterFactory;
116-
$this->customObjectModel = $customObjectModel;
117-
$this->customItemModel = $customItemModel;
118-
$this->customFieldModel = $customFieldModel;
119-
$this->tokenParser = $tokenParser;
120-
$this->eventModel = $eventModel;
121-
$this->eventDispatcher = $eventDispatcher;
122-
$this->tokenFormatter = $tokenFormatter;
119+
$this->configProvider = $configProvider;
120+
$this->queryFilterHelper = $queryFilterHelper;
121+
$this->queryFilterFactory = $queryFilterFactory;
122+
$this->customObjectModel = $customObjectModel;
123+
$this->customItemModel = $customItemModel;
124+
$this->customFieldModel = $customFieldModel;
125+
$this->tokenParser = $tokenParser;
126+
$this->eventModel = $eventModel;
127+
$this->eventDispatcher = $eventDispatcher;
128+
$this->tokenFormatter = $tokenFormatter;
129+
$this->leadCustomItemFetchLimit = $leadCustomItemFetchLimit;
123130
}
124131

125132
/**
@@ -462,7 +469,7 @@ private function getCustomItems(CustomObject $customObject, string $leadId): arr
462469
$orderBy = CustomItem::TABLE_ALIAS.'.id';
463470
$orderDir = 'DESC';
464471

465-
$tableConfig = new TableConfig(15, 1, $orderBy, $orderDir);
472+
$tableConfig = new TableConfig($this->leadCustomItemFetchLimit, 1, $orderBy, $orderDir);
466473
$tableConfig->addParameter('customObjectId', $customObject->getId());
467474
$tableConfig->addParameter('filterEntityType', 'contact');
468475
$tableConfig->addParameter('filterEntityId', $leadId);

Tests/Unit/EventListener/TokenSubscriberTest.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ protected function setUp(): void
135135
$this->tokenParser,
136136
$this->eventModel,
137137
$this->eventDispatcher,
138-
$this->tokenFormatter
138+
$this->tokenFormatter,
139+
15
139140
);
140141

141142
$this->builderEvent = $this->createMock(BuilderEvent::class);
@@ -857,7 +858,8 @@ private function constructWithDependencies(): void
857858
$this->tokenParser,
858859
$this->eventModel,
859860
$this->eventDispatcher,
860-
new TokenFormatter()
861+
new TokenFormatter(),
862+
15
861863
);
862864
}
863865
}

0 commit comments

Comments
 (0)