Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DocumentFactory.php
Go to the documentation of this file.
1 <?php
7 
15 
22 {
30  protected $objectManager;
31 
35  private $entityMetadata;
36 
42  {
43  $this->objectManager = $objectManager;
44  $this->entityMetadata = $entityMetadata;
45  }
46 
54  public function create($rawDocument)
55  {
57  $attributes = [];
58  $documentId = null;
59  $entityId = $this->entityMetadata->getEntityId();
60  foreach ($rawDocument as $fieldName => $value) {
61  if ($fieldName === $entityId) {
62  $documentId = $value;
63  } elseif ($fieldName === '_score') {
64  $attributes['score'] = new AttributeValue(
65  [
68  ]
69  );
70  }
71  }
72 
73  return new Document(
74  [
75  DocumentInterface::ID => $documentId,
77  ]
78  );
79  }
80 }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$value
Definition: gender.phtml:16
$attributes
Definition: matrix.phtml:13
__construct(ObjectManagerInterface $objectManager, EntityMetadata $entityMetadata)