Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
TaxSetup.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Tax\Setup;
7 
10 use Magento\Sales\Setup\SalesSetupFactory;
11 
15 class TaxSetup
16 {
20  protected $salesSetup;
21 
27  protected $productTypeConfig;
28 
36  public function __construct(
38  SalesSetupFactory $salesSetupFactory,
40  ) {
41  $this->salesSetup = $salesSetupFactory->create(['resourceName' => 'tax_setup', 'setup' => $setup]);
42  $this->productTypeConfig = $productTypeConfig;
43  }
44 
50  public function getTaxableItems()
51  {
52  return $this->productTypeConfig->filter('taxable');
53  }
54 
63  public function addAttribute($entityTypeId, $code, array $attr)
64  {
65  //Delegate
66  return $this->salesSetup->addAttribute($entityTypeId, $code, $attr);
67  }
68 
79  public function updateAttribute($entityTypeId, $id, $field, $value = null, $sortOrder = null)
80  {
81  //Delegate
82  return $this->salesSetup->updateAttribute($entityTypeId, $id, $field, $value, $sortOrder);
83  }
84 }
addAttribute($entityTypeId, $code, array $attr)
Definition: TaxSetup.php:63
$attr
Definition: text.phtml:8
$id
Definition: fieldset.phtml:14
updateAttribute($entityTypeId, $id, $field, $value=null, $sortOrder=null)
Definition: TaxSetup.php:79
$value
Definition: gender.phtml:16
__construct(ModuleDataSetupInterface $setup, SalesSetupFactory $salesSetupFactory, ConfigInterface $productTypeConfig)
Definition: TaxSetup.php:36
$setup
Definition: trigger.php:12
$code
Definition: info.phtml:12