Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateMain.php
Go to the documentation of this file.
1 <?php
7 
11 
16 {
20  private $typeResolver;
21 
25  private $hydratorPool;
26 
30  private $updateRow;
31 
37  public function __construct(
38  TypeResolver $typeResolver,
39  HydratorPool $hydratorPool,
40  UpdateRow $updateRow
41  ) {
42  $this->typeResolver = $typeResolver;
43  $this->hydratorPool = $hydratorPool;
44  $this->updateRow = $updateRow;
45  }
46 
52  public function execute($entity, $arguments = [])
53  {
54  $entityType = $this->typeResolver->resolve($entity);
55  $hydrator = $this->hydratorPool->getHydrator($entityType);
56  $arguments = array_merge($hydrator->extract($entity), $arguments);
57  $entityData = $this->updateRow->execute($entityType, $arguments);
58  $entity = $hydrator->hydrate($entity, $entityData);
59  return $entity;
60  }
61 }
__construct(TypeResolver $typeResolver, HydratorPool $hydratorPool, UpdateRow $updateRow)
Definition: UpdateMain.php:37
$entity
Definition: element.phtml:22
$arguments