Skip to content

Commit

Permalink
Fix for getting prefixed table name in PayPal Quote Updater.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Canning committed Jul 24, 2019
1 parent 00fcfc4 commit a00d35d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions Model/Paypal/Helper/QuoteUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
namespace Magento\Braintree\Model\Paypal\Helper;

use InvalidArgumentException;
use Magento\Framework\App\ResourceConnection;
use Magento\Quote\Model\Quote;
use Magento\Quote\Model\Quote\Address;
use Magento\Quote\Model\Quote\Payment;
use Magento\Quote\Api\CartRepositoryInterface;
use Magento\Braintree\Model\Ui\PayPal\ConfigProvider;
use Magento\Framework\Exception\LocalizedException;
use Magento\Braintree\Observer\DataAssignObserver;
use Magento\Braintree\Gateway\Config\PayPal\Config;
use Magento\Framework\Event\ManagerInterface;
use Magento\Quote\Model\Quote\Address;

/**
* Class QuoteUpdater
Expand All @@ -32,33 +32,33 @@ class QuoteUpdater extends AbstractHelper
private $quoteRepository;

/**
* @var \Magento\Quote\Model\ResourceModel\Quote\Address
* @var ManagerInterface
*/
private $addressFactory;
private $eventManager;

/**
* @var ManagerInterface
* @var ResourceConnection
*/
private $eventManager;
private $resource;

/**
* Constructor
*
* @param Config $config
* @param CartRepositoryInterface $quoteRepository
* @param ManagerInterface $eventManager
* @param \Magento\Quote\Model\ResourceModel\Quote\Address $addressFactory
* @param ResourceConnection $resource
*/
public function __construct(
Config $config,
CartRepositoryInterface $quoteRepository,
ManagerInterface $eventManager,
\Magento\Quote\Model\ResourceModel\Quote\Address $addressFactory
ResourceConnection $resource
) {
$this->config = $config;
$this->quoteRepository = $quoteRepository;
$this->eventManager = $eventManager;
$this->addressFactory = $addressFactory;
$this->resource = $resource;
}

/**
Expand Down Expand Up @@ -127,8 +127,9 @@ private function updateQuote(Quote $quote, array $details)
*/
private function cleanUpAddress(Quote $quote)
{
$tableName = $this->addressFactory->getConnection()->getTableName('quote_address');
$this->addressFactory->getConnection()->delete(
$connection = $this->resource->getConnection();
$tableName = $this->resource->getTableName('quote_address');
$connection->delete(
$tableName,
'quote_id = ' . (int) $quote->getId() . ' AND email IS NULL'
);
Expand Down

0 comments on commit a00d35d

Please sign in to comment.