Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Document.php
Go to the documentation of this file.
1 <?php
7 
9 
14 class Document extends AbstractSimpleObject implements DocumentInterface, \IteratorAggregate
15 {
19  public function getId()
20  {
21  return $this->_get(self::ID);
22  }
23 
27  public function setId($id)
28  {
29  return $this->setData(self::ID, $id);
30  }
31 
36  {
37  return $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode] ?? null;
38  }
39 
43  public function setCustomAttribute($attributeCode, $attributeValue)
44  {
47  $attributes[$attributeCode] = $attributeValue;
48  return $this->setCustomAttributes($attributes);
49  }
50 
54  public function getCustomAttributes()
55  {
56  return $this->_get(self::CUSTOM_ATTRIBUTES);
57  }
58 
62  public function setCustomAttributes(array $attributes)
63  {
64  return $this->setData(self::CUSTOM_ATTRIBUTES, $attributes);
65  }
66 
73  public function getIterator()
74  {
75  $attributes = (array)$this->getCustomAttributes();
76  return new \ArrayIterator($attributes);
77  }
78 }
$id
Definition: fieldset.phtml:14
setCustomAttribute($attributeCode, $attributeValue)
$attributeCode
Definition: extend.phtml:12
setCustomAttributes(array $attributes)
Definition: Document.php:62
$attributes
Definition: matrix.phtml:13