Prevent changes for read-only fields (like bundle)

Created on 20 March 2014, about 11 years ago
Updated 12 March 2025, 24 days ago

Follow-up of #2182239: Improve ContentEntityBase::id() for better DX β†’ .

+++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php
@@ -599,6 +617,15 @@ public function onChange($name) {
+    // that check, as it ready only and must not change, unsetting it could

True, but that means we should throw an exception then I guess? We've got the 'read only' flag in typed data which does not throw any exceptions or so right now (as we did not had onChange() initially), so what about throwing exceptions for changes on read-only properties in general?
-> should be its own issue.

The code there assumes for now that the same bundle has been set again, due to weird code like the hal serializer.

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

entity system

Created by

πŸ‡¨πŸ‡­Switzerland berdir Switzerland

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024