/** * Decorator's constructor * * @param \Elastica\ResultSet $resultSet The results from Elastica to wrap * @param \Elastica\Query $query The Elasticsearch Query object */ public function __construct($resultSet, $query) { $this->resultSet = $resultSet; $repo = $query->repository(); foreach ($repo->embedded() as $embed) { $this->embeds[$embed->property()] = $embed; } $this->entityClass = $repo->entityClass(); $this->repoName = $repo->name(); parent::__construct($resultSet); }