Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/Reflection/EntityFieldReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,8 @@ public function getWritableType(): Type
return new ObjectType($objectType);
}

// @todo Drupal allows $entity->field_myfield = 'string'; does this break that?
if ($this->isContentEntityType()) {
// Assume the property is a field.
return new ObjectType(FieldItemListInterface::class);
}

// ContentEntityBase::__set() passes the value to the field's
// setValue(), so $entity->field_myfield = 'string' is valid.
return new MixedType();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ public function testGetPropertyEntity(): void
$readableType = $propertyReflection->getReadableType();
self::assertInstanceOf(ObjectType::class, $readableType);
self::assertEquals(FieldItemListInterface::class, $readableType->getClassName());
$writeableType = $propertyReflection->getWritableType();
self::assertInstanceOf(ObjectType::class, $writeableType);
self::assertEquals(FieldItemListInterface::class, $writeableType->getClassName());
self::assertInstanceOf(MixedType::class, $propertyReflection->getWritableType());

$originalPropertyReflection = $this->extension->getProperty($classReflection, 'original');
$readableType = $originalPropertyReflection->getReadableType();
Expand Down
Loading