{"action":"created","issue":{"url":"https://api.github.com/repos/Jaesin/content_entity_base/issues/7","labels_url":"https://api.github.com/repos/Jaesin/content_entity_base/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/Jaesin/content_entity_base/issues/7/comments","events_url":"https://api.github.com/repos/Jaesin/content_entity_base/issues/7/events","html_url":"https://github.com/Jaesin/content_entity_base/pull/7","id":116837911,"number":7,"title":"Don't hardcode the 'type' as bundle field","user":{"login":"dawehner","id":29678,"avatar_url":"https://avatars.githubusercontent.com/u/29678?v=3","gravatar_id":"","url":"https://api.github.com/users/dawehner","html_url":"https://github.com/dawehner","followers_url":"https://api.github.com/users/dawehner/followers","following_url":"https://api.github.com/users/dawehner/following{/other_user}","gists_url":"https://api.github.com/users/dawehner/gists{/gist_id}","starred_url":"https://api.github.com/users/dawehner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dawehner/subscriptions","organizations_url":"https://api.github.com/users/dawehner/orgs","repos_url":"https://api.github.com/users/dawehner/repos","events_url":"https://api.github.com/users/dawehner/events{/privacy}","received_events_url":"https://api.github.com/users/dawehner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-13T19:39:48Z","updated_at":"2015-12-09T19:40:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Jaesin/content_entity_base/pulls/7","html_url":"https://github.com/Jaesin/content_entity_base/pull/7","diff_url":"https://github.com/Jaesin/content_entity_base/pull/7.diff","patch_url":"https://github.com/Jaesin/content_entity_base/pull/7.patch"},"body":null},"comment":{"url":"https://api.github.com/repos/Jaesin/content_entity_base/issues/comments/163368423","html_url":"https://github.com/Jaesin/content_entity_base/pull/7#issuecomment-163368423","issue_url":"https://api.github.com/repos/Jaesin/content_entity_base/issues/7","id":163368423,"user":{"login":"bdragon28","id":167753,"avatar_url":"https://avatars.githubusercontent.com/u/167753?v=3","gravatar_id":"","url":"https://api.github.com/users/bdragon28","html_url":"https://github.com/bdragon28","followers_url":"https://api.github.com/users/bdragon28/followers","following_url":"https://api.github.com/users/bdragon28/following{/other_user}","gists_url":"https://api.github.com/users/bdragon28/gists{/gist_id}","starred_url":"https://api.github.com/users/bdragon28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdragon28/subscriptions","organizations_url":"https://api.github.com/users/bdragon28/orgs","repos_url":"https://api.github.com/users/bdragon28/repos","events_url":"https://api.github.com/users/bdragon28/events{/privacy}","received_events_url":"https://api.github.com/users/bdragon28/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T19:40:02Z","updated_at":"2015-12-09T19:40:02Z","body":"Here's one that doesn't actually crash... Thoughts?\r\n```diff\r\ndiff --git a/src/Entity/Form/EntityBaseForm.php b/src/Entity/Form/EntityBaseForm.php\r\nindex 661898a..8be9cfd 100644\r\n--- a/src/Entity/Form/EntityBaseForm.php\r\n+++ b/src/Entity/Form/EntityBaseForm.php\r\n@@ -28,7 +28,7 @@ class EntityBaseForm extends ContentEntityForm {\r\n     parent::prepareEntity();\r\n \r\n     /** @var EntityTypeBaseInterface $entity_type */\r\n-    $entity_type = $this->entity->type->referencedEntities()[0];\r\n+    $entity_type = $this->entity->{$this->entity->getEntityType()->getKey('bundle')}->referencedEntities()[0];\r\n \r\n     // Set up default values, if required.\r\n     if (!$this->entity->isNew()) {\r\n@@ -110,7 +110,7 @@ class EntityBaseForm extends ContentEntityForm {\r\n    */\r\n   public function save(array $form, FormStateInterface $form_state) {\r\n     /** @var EntityTypeBaseInterface $entity_type */\r\n-    $entities = $this->entity->type->referencedEntities();\r\n+    $entities = $this->entity->{$this->entity->getEntityType()->getKey('bundle')}->referencedEntities();\r\n     $entity_type = reset($entities);\r\n \r\n     // Save as a new revision if requested to do so.\r\n```"}}