Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
OrderIncrementIdChecker.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
8 namespace Magento\Sales\Model;
9 
14 {
18  private $resourceModel;
19 
23  public function __construct(ResourceModel\Order $resourceModel)
24  {
25  $this->resourceModel = $resourceModel;
26  }
27 
36  public function isIncrementIdUsed($orderIncrementId): bool
37  {
39  $adapter = $this->resourceModel->getConnection();
40  $bind = [':increment_id' => $orderIncrementId];
42  $select = $adapter->select();
43  $select->from($this->resourceModel->getMainTable(), $this->resourceModel->getIdFieldName())
44  ->where('increment_id = :increment_id');
45  $entity_id = $adapter->fetchOne($select, $bind);
46  if ($entity_id > 0) {
47  return true;
48  }
49 
50  return false;
51  }
52 }
$adapter
Definition: webapi_user.php:16
__construct(ResourceModel\Order $resourceModel)
$resourceModel
Definition: tablerates.php:10