-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from klaviyo/202109_m2_infinite_loop_issue_fix
adding code changes to handle infinite loop issue
- Loading branch information
Showing
5 changed files
with
64 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Klaviyo\Reclaim\Model\Quote; | ||
use Magento\Framework\Model\ResourceModel\Db\AbstractDb; | ||
/** | ||
* QuoteIdMask Resource model | ||
* @codeCoverageIgnore | ||
*/ | ||
class QuoteIdMask extends AbstractDb | ||
{ | ||
/** | ||
* Main table and field initialization | ||
* | ||
* @return void | ||
*/ | ||
protected function _construct() | ||
{ | ||
$this->_init('quote_id_mask', 'entity_id'); | ||
} | ||
|
||
/** | ||
* Retrieves masked quote id | ||
* | ||
* Uses direct DB query due to performance reasons | ||
* | ||
* @param int $quoteId | ||
* @return string|null | ||
*/ | ||
public function getMaskedQuoteId(int $quoteId): ?string | ||
{ | ||
$connection = $this->getConnection(); | ||
$mainTable = $this->getMainTable(); | ||
$field = $connection->quoteIdentifier(sprintf('%s.%s', $mainTable, 'quote_id')); | ||
|
||
$select = $connection->select() | ||
->from($mainTable, ['masked_id']) | ||
->where($field . '=?', $quoteId); | ||
|
||
$result = $connection->fetchOne($select); | ||
|
||
return $result ?: null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters