commit 071d75a4f670c9a8410f1aa2161e87b29f3a2aff Author: fago Date: Mon Jun 3 19:49:36 2013 +0200 Fixed typedData() updates and bundle() usage. diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index 81fc428..4b1a89e 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -409,10 +409,10 @@ public function getNGEntity() { * Implements \Drupal\Core\TypedData\TypedDataInterface::getType(). */ public function getType() { - if ($this->bundle != $this->entityType) { - return 'entity:' . $this->entityType . ':' . $this->bundle; + if ($this->bundle() != $this->entityType()) { + return 'entity:' . $this->entityType() . ':' . $this->bundle(); } - return 'entity:' . $this->entityType; + return 'entity:' . $this->entityType(); } /** diff --git a/core/lib/Drupal/Core/TypedData/DataReferenceBase.php b/core/lib/Drupal/Core/TypedData/DataReferenceBase.php index 14f3587..939e00c 100644 --- a/core/lib/Drupal/Core/TypedData/DataReferenceBase.php +++ b/core/lib/Drupal/Core/TypedData/DataReferenceBase.php @@ -41,7 +41,7 @@ public function getValue() { * {@inheritdoc} */ public function setValue($value, $notify = TRUE) { - $this->target = typed_data()->create($this->getTargetDefinition(), $value); + $this->target = \Drupal::typedData()->create($this->getTargetDefinition(), $value); // Notify the parent of any changes. if ($notify && isset($this->parent)) { $this->parent->onChange($this->name); diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php index 0521f8c..462d5de 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php @@ -525,7 +525,7 @@ public function testEntityConstraintValidation() { ), 'label' => 'Test entity', ); - $reference_field_item = typed_data()->create($definition); + $reference_field_item = \Drupal::TypedData()->create($definition); $reference = $reference_field_item->get('entity'); $reference->setValue($entity); @@ -552,7 +552,7 @@ public function testEntityConstraintValidation() { 'target_bundle' => 'article', ), ); - $reference_field_item = typed_data()->create($definition); + $reference_field_item = \Drupal::TypedData()->create($definition); $reference = $reference_field_item->get('entity'); $reference->setValue($node); $violations = $reference->validate();