Add entity info key to indicate if exportable entities are stored as json instead of DB
評価
調査の方向性
Start with hook_entity_info() and _entity_plus_defaults_rebuild(), which are the entry points named in the issue, then inspect EntityPlusControllerExportable and the existing schema_fields_sql checks. Define and consume an indicator for JSON-stored exportable entities so cache clear and module enable/disable do not require a dummy base table; verify the behavior with a JSON-stored entity such as rules_config.
索引モデルが issue の本文から書いたものです。
説明
It would be helpful to add a key to the array returned by hook_entity_info() to indicate that an exportable entity (aka "configuration entity") is stored as a json config file instead of in the database. This would allow us to avoid some fatal errors such as the one that happens in _entity_plus_defaults_rebuild() in the if statement that checks for $info['schema_fields_sql']['base table']. Since the entity is stored as json, it doesn't define hook_schema() and it doesn't have $info['schema_fields_sql']['base table']
This key could be called 'json storage'. If TRUE, then we could avoid the error I described above by skipping the if statement. Plus this may also provide other benefits (for example to Entity UI).
Some background on this:
_entity_plus_defaults_rebuild() (called _entity_defaults_rebuild in D7) was added a long time ago in D7. Before it, exportable entities could be defined in code, and would not be store in the database unless they were overridden. After the patch, this function stored all "in code" exportable entities to the database on cache clear or module enable/disable.
The problem I'm facing is that I'm working on the module Entity Plus CMI to create a Rules submodule. This submodule would save/load Rules configurations from json instead of database, making them available to the CMI api of Backdrop. Entity Plus CMI overrides EntityPlusControllerExportable. The main difference between exportable entities stored in the DB and those stored in config is that the second one doesn't use hook_schema(). Rather, it's "fields" are defined by including the fields to be read/saved in hook_entity_property_info().
This is working great, except that, when _entity_plus_defaults_rebuild()runs upon cache clear, we get a fatal error because the info for the entity doesn't contain $info['schema_fields_sql']['base table']. As a temporary fix, I have manually created a "dummy" array element called schema_fields_sql and a subarray base table in the entity definition array to fool that function.
Eventually, if we defined this key, providing a dummy info array element would be unnecessary, and it will provide other benefits to the Entity Plus code. It would allow to seamlessly move configuration entities such as rules_config and others (e.g. those provided by Search API) to config.
- 主要言語
- PHP
- スター
- 3
- フォーク
- 11
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
backdrop-contrib/entity_plus のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
backdrop-contrib/entity_plus#140 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
backdrop-contrib/entity_plus#177 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
backdrop-contrib/entity_plus#170 · コメント 1 件 · リアクション 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
backdrop-contrib/entity_plus#168 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
backdrop-contrib/entity_plus#157 ·
backdrop-contrib/entity_plus の issue をすべて見る
似ている issue
-
type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
flarum/framework#5301 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Add TuneIn-DirMon in the bot list対応中かも @liviuconcioiu が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
matomo-org/device-detector#8424 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
メンテナーはふだん 1 日以内に返信
-
affecting 5.2 only affecting 5.3 only bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
moodle-an-hochschulen/moodle-theme_boost_union#1463 ·
メンテナーはふだん 1 日以内に返信
-
Course help wanted Sensei
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100