public function get($primaryKey, $options = [])
{
$type = $this->connection()->getIndex()->getType($this->name());
$result = $type->getDocument($primaryKey, $options);
$class = $this->entityClass();
$options = ['markNew' => false, 'markClean' => true, 'useSetters' => false, 'source' => $this->name()];
$data = $result->getData();
$data['id'] = $result->getId();
foreach ($this->embedded() as $embed) {
$prop = $embed->property();
if (isset($data[$prop])) {
$data[$prop] = $embed->hydrate($data[$prop], $options);
}
}
return new $class($data, $options);
}