Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ObjectRegistry.php
Go to the documentation of this file.
1 <?php
7 
9 {
15  protected $entitiesMap;
16 
20  public function __construct($entities)
21  {
22  $this->entitiesMap = [];
23  foreach ($entities as $entity) {
24  $this->entitiesMap[$entity->getId()] = $entity;
25  }
26  }
27 
32  public function get($entityId)
33  {
34  return isset($this->entitiesMap[$entityId]) ? $this->entitiesMap[$entityId] : null;
35  }
36 
40  public function getList()
41  {
42  return $this->entitiesMap;
43  }
44 }
$entity
Definition: element.phtml:22