Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
HydratorPool.php
Go to the documentation of this file.
1 <?php
7 
9 
14 {
18  private $hydrators;
19 
23  protected $objectManager;
24 
29  public function __construct(
31  $hydrators = []
32  ) {
33  $this->objectManager = $objectManager;
34  $this->hydrators = $hydrators;
35  }
36 
41  public function getHydrator($entityType)
42  {
43  if (isset($this->hydrators[$entityType])) {
44  return $this->objectManager->get($this->hydrators[$entityType]);
45  } else {
46  return $this->objectManager->get(HydratorInterface::class);
47  }
48  }
49 }
__construct(ObjectManagerInterface $objectManager, $hydrators=[])