Skip to content

Refactor entites and operators - #203

Closed
iMattPro wants to merge 1 commit into
phpbb-extensions:masterfrom
iMattPro:refactor-entities
Closed

iMattPro wants to merge 1 commit into
phpbb-extensions:masterfrom
iMattPro:refactor-entities

Conversation

@iMattPro

Copy link
Copy Markdown
Contributor

No description provided.

@codecov-commenter

codecov-commenter commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.54839% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.84%. Comparing base (7e3c752) to head (6e81432).

Files with missing lines Patch % Lines
controller/admin_controller.php 79.16% 5 Missing ⚠️
entity/page.php 93.33% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #203      +/-   ##
============================================
- Coverage     97.42%   96.84%   -0.59%     
- Complexity      268      276       +8     
============================================
  Files            21       22       +1     
  Lines           855      887      +32     
============================================
+ Hits            833      859      +26     
- Misses           22       28       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Keep hydration side-effect free so stored values are not transformed as new input. Use explicit factories and update only dirty fields.

BREAKING CHANGE: Page and rule entities no longer expose load(), insert(), or save(). Their non-shared service IDs were also removed. Use operator create, get, add, and save methods instead.

Refinements to refactoring

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical public API and container service compatibility breaks remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity

Open (2)
What changed in this PR

This pull request refactors page persistence around a factory-backed page operator, updating controllers, services, entities, and tests.

Changes:

  • Moves entity lifecycle operations into the page operator.
  • Adds hydration, change tracking, and storage validation.
  • Updates dependency injection, error handling, and test coverage.
File Reviewed changes
tests/​operators/​page_operator_save_page_test.php Tests operator saves and Unicode behavior.
tests/​operators/​page_operator_delete_page_test.php Tests operator lookup after deletion.
tests/​operators/​page_operator_base.php Initializes and injects the entity factory.
tests/​operators/​page_operator_add_page_test.php Tests operator entity retrieval.
tests/​event/​show_page_links_test.php Updates operator construction.
tests/​entity/​page_entity_title_test.php Adds Unicode length boundary coverage.
tests/​entity/​page_entity_save_test.php Removes obsolete entity save tests.
tests/​entity/​page_entity_route_test.php Uses import-based hydration.
tests/​entity/​page_entity_load_test.php Removes obsolete load tests.
tests/​entity/​page_entity_insert_test.php Removes obsolete insert tests.
tests/​entity/​page_entity_import_test.php Tests storage preservation and atomic imports.
tests/​entity/​page_entity_description_test.php Adds Unicode length boundary coverage.
tests/​controller/​page_main_controller_test.php Injects the page operator.
tests/​controller/​admin_controller_test.php Updates services and error-path coverage.
operators/​page.php Adds factory-based retrieval and persistence operations.
operators/​page_interface.php Defines the expanded operator API.
exception/​base.php Simplifies language loading.
entity/​page.php Adds hydration, change tracking, and storage-length checks.
entity/​page_interface.php Removes lifecycle methods; critical (2 votes): this breaks the public load(), insert(), and save() API without compatibility or migration guidance.
entity/​factory.php Provides fresh page entities.
controller/​main_controller.php Uses the page operator.
controller/​admin_controller.php Uses injected services and handles failures.
config/​services.yml Wires the factory and updated dependencies; critical (2 votes): removing phpbb.pages.entity breaks extensions retrieving the existing service ID.
acp/​pages_module.php Adds the controller type annotation.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread config/services.yml
Comment on lines +113 to 117
phpbb.pages.entity_factory:
class: phpbb\pages\entity\factory
arguments:
- '@dbal.conn'
- '@config'
Comment thread entity/page_interface.php
Comment on lines 35 to +40
/**
* Insert the page data for the first time
*
* Will throw an exception if the page was already inserted (call save() instead)
*
* @return page_interface $this object for chaining calls; load()->set()->save()
* @access public
* @throws \phpbb\pages\exception\out_of_bounds
*/
public function insert();
* Export current storage-form data.
*
* @return array
*/
public function get_data();
@iMattPro iMattPro closed this Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants