Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Rate.php
Go to the documentation of this file.
1 <?php
13 
15 {
21  protected function _construct()
22  {
23  $this->_init('tax_calculation_rate', 'tax_calculation_rate_id');
24  }
25 
31  protected function _initUniqueFields()
32  {
33  $this->_uniqueFields = [['field' => ['code'], 'title' => __('Code')]];
34  return $this;
35  }
36 
42  public function deleteAllRates()
43  {
44  $this->getConnection()->delete($this->getMainTable());
45  return $this;
46  }
47 
54  public function isInRule($rateId)
55  {
56  $connection = $this->getConnection();
57  $select = $connection->select()->from(
58  $this->getTable('tax_calculation'),
59  ['tax_calculation_rate_id']
60  )->where(
61  'tax_calculation_rate_id = ?',
62  $rateId
63  );
64  return $connection->fetchCol($select);
65  }
66 }
__()
Definition: __.php:13
$connection
Definition: bulk.php:13