Skip to content

Commit f3c3a1d

Browse files
used resourceConnection
1 parent 64066c4 commit f3c3a1d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

app/code/Magento/Newsletter/Model/RemoveSubscriberFromQueueLink.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,23 @@
88
namespace Magento\Newsletter\Model;
99

1010
use Magento\Framework\App\ResourceConnection;
11-
use Magento\Framework\DB\Adapter\AdapterInterface;
1211

1312
/**
1413
* Responsible for removing subscriber from queue
1514
*/
1615
class RemoveSubscriberFromQueueLink
1716
{
1817
/**
19-
* @var AdapterInterface
18+
* @var ResourceConnection
2019
*/
21-
private $connection;
20+
private $resourceConnection;
2221

2322
/**
24-
* @param ResourceConnection $resource
23+
* @param ResourceConnection $resourceConnection
2524
*/
26-
public function __construct(ResourceConnection $resource)
25+
public function __construct(ResourceConnection $resourceConnection)
2726
{
28-
$this->connection = $resource->getConnection();
27+
$this->resourceConnection = $resourceConnection;
2928
}
3029

3130
/**
@@ -36,8 +35,10 @@ public function __construct(ResourceConnection $resource)
3635
*/
3736
public function execute(int $subscriberId): void
3837
{
39-
$this->connection->delete(
40-
$this->connection->getTableName('newsletter_queue_link'),
38+
$connection = $this->resourceConnection->getConnection();
39+
40+
$connection->delete(
41+
$this->resourceConnection->getTableName('newsletter_queue_link'),
4142
['subscriber_id = ?' => $subscriberId, 'letter_sent_at IS NULL']
4243
);
4344
}

0 commit comments

Comments
 (0)