commit 7f8fdca58039a4ce797fec8a534b4d7e8c9ff8e3
Author: Lee Rowlands <lee.rowlands@previousnext.com.au>
Date:   Thu Nov 14 21:08:35 2013 +1000

    Fix for setting it

diff --git a/core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php b/core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php
index 414a284..10f2aca 100644
--- a/core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php
+++ b/core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php
@@ -129,6 +129,8 @@ function setUp() {
     foreach ($normalizers as $normalizer) {
       $normalizer->setLinkManager($link_manager);
     }
+    $entity_normalizer = reset($normalizers);
+    $entity_normalizer->setEntityManager(\Drupal::entityManager());
     $encoders = array(
       new JsonEncoder(),
     );

commit 3011a3ef801505796924f8e7dc4da5edb5db8760
Author: Lee Rowlands <lee.rowlands@previousnext.com.au>
Date:   Thu Nov 14 17:52:41 2013 +1000

    fix for hal normalizer https://drupal.org/node/2135573

diff --git a/core/modules/hal/hal.services.yml b/core/modules/hal/hal.services.yml
index 7f3e405..4f91cba 100644
--- a/core/modules/hal/hal.services.yml
+++ b/core/modules/hal/hal.services.yml
@@ -24,6 +24,7 @@ services:
       - { name: normalizer, priority: 10 }
     calls:
       - [setLinkManager, ['@rest.link_manager']]
+      - [setEntityManager, ['@entity.manager']]
   serializer.encoder.hal:
     class: Drupal\hal\Encoder\JsonEncoder
     tags:
diff --git a/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php b/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php
index a3aa448..63d3180 100644
--- a/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php
+++ b/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php
@@ -9,6 +9,7 @@
 
 use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Entity\ContentEntityBase;
+use Drupal\Core\Entity\EntityManager;
 use Drupal\Core\Language\Language;
 use Symfony\Component\Serializer\Exception\UnexpectedValueException;
 
@@ -18,6 +19,13 @@
 class EntityNormalizer extends NormalizerBase {
 
   /**
+   * The entity manager service.
+   *
+   * @var \Drupal\Core\Entity\EntityManager
+   */
+  protected $entityManager;
+
+  /**
    * The interface or class that this Normalizer supports.
    *
    * @var string
@@ -99,7 +107,12 @@ public function denormalize($data, $class, $format = NULL, array $context = arra
       $langcode = Language::LANGCODE_NOT_SPECIFIED;
     }
 
-    $entity = entity_create($typed_data_ids['entity_type'], array('langcode' => $langcode, 'type' => $typed_data_ids['bundle']));
+    $info = $this->entityManager->getDefinition($typed_data_ids['entity_type']);
+    $values = array('langcode' => $langcode);
+    if (!empty($info['entity_keys']['bundle']) && ($bundle_key = $info['entity_keys']['bundle'])) {
+      $values[$bundle_key] = $typed_data_ids['bundle'];
+    }
+    $entity = $this->entityManager->getStorageController($typed_data_ids['entity_type'])->create($values);
 
     // Special handling for PATCH: destroy all possible default values that
     // might have been set on entity creation. We want an "empty" entity that
@@ -203,4 +216,14 @@ protected function getTypedDataIds($types) {
 
     return $typed_data_ids;
   }
+
+  /**
+   * Sets the entity manager service.
+   *
+   * @param \Drupal\Core\Entity\EntityManager $entity_manager
+   *   The entity manager service.
+   */
+  public function setEntityManager(EntityManager $entity_manager) {
+    $this->entityManager = $entity_manager;
+  }
 }
