Rework entity stubs to support translations and pre-post-save functions

Created on 27 October 2022, about 2 years ago
Updated 3 March 2023, over 1 year ago

Problem/Motivation

Currently Entity Stubs have custom initialization and save functions, which makes it problematic to make working translations and other stuff.
So, the idea is to start using native constructors for entities, and override the doSaveFieldItems() instead of save().

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇦🇲Armenia murz Yerevan, Armenia

Live updates comments and jobs are added and updated live.
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.

  • @murz opened merge request.
  • 🇦🇲Armenia murz Yerevan, Armenia
    • Murz committed c4dc2300 on 1.0.x
      Issue #3317747 by Murz: Rework entity stubs to support translations and...
  • Status changed to Fixed over 1 year ago
  • 🇦🇲Armenia murz Yerevan, Armenia

    I've reworked a lot of under-the-hood things to make the entity stubs works more like in kernel tests, calling a node constructor function on initialization, and all preSave and postSave functions on save.

    This is allowed usage of native translation API of the entity stubs via functions addTranslation() - hasTranslation() - getTranslation(), entity reference fields start working out of the box, configuring custom field types and settings, and a lot more features, that previously didn't work as expected.

    No serious changes in the public API have happened. Still, under-the-hood rework can change the behavior of some unit tests, so please look at the provided examples and report issues if you get serious problems.

  • Status changed to Fixed over 1 year ago
  • 🇦🇲Armenia murz Yerevan, Armenia
Production build 0.71.5 2024