Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ReservedAttributeList.php
Go to the documentation of this file.
1 <?php
10 
16 {
21 
27  public function __construct($productModel, array $reservedAttributes = [], array $allowedAttributes = [])
28  {
29  $methods = get_class_methods($productModel);
30  foreach ($methods as $method) {
31  if (preg_match('/^get([A-Z]{1}.+)/', $method, $matches)) {
32  $method = $matches[1];
33  $tmp = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $method));
34  $reservedAttributes[] = $tmp;
35  }
36  }
37  $this->_reservedAttributes = array_diff($reservedAttributes, $allowedAttributes);
38  }
39 
47  {
48  return $attribute->getIsUserDefined() && in_array($attribute->getAttributeCode(), $this->_reservedAttributes);
49  }
50 }
__construct($productModel, array $reservedAttributes=[], array $allowedAttributes=[])
$methods
Definition: billing.phtml:71
$method
Definition: info.phtml:13
$productModel