[PR #625] [MERGED] Add repository layer to handlers for better and centralized entity and session management #938

Closed
opened 2026-02-25 21:36:42 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/cypht-org/cypht/pull/625
Author: @henrique-borba
Created: 9/23/2022
Status: Merged
Merged: 2/16/2024
Merged by: @kroky

Base: masterHead: fix/smtp_server_unique_ids


📝 Commits (10+)

  • 308eced fix double require of hm-profiles.php file in profiles and nux modules
  • 4f7dd1c SMTP servers unique ids
  • caea86c All other id entities (JMAP, Feeds, Profiles...)
  • bd27371 Hotfix profiles ids
  • 1da06d5 Repository layer for Handlers and centralized entity and id management
  • 180ce61 Profile use setDefault method
  • ce62109 migrate profiles, imap/smtp/feed server list to repository trait with unique ID management to get rid of array index integer values mixing up when deleting entries
  • 9abc745 fix tests after repository ID changes and bootstrap switch
  • 48d5abe make local contacts use repository pattern and integrate with remote contacts
  • d708645 repository IDs migration script

📊 Changes

41 files changed (+630 additions, -446 deletions)

View changed files

📝 config/app.php (+0 -9)
📝 lib/framework.php (+1 -0)
📝 lib/module.php (+1 -0)
📝 lib/modules.php (+13 -0)
lib/repository.php (+147 -0)
📝 lib/servers.php (+17 -28)
📝 modules/carddav_contacts/hm-carddav.php (+5 -8)
📝 modules/contacts/hm-contacts.php (+45 -25)
📝 modules/contacts/modules.php (+1 -0)
📝 modules/contacts/setup.php (+2 -2)
📝 modules/core/handler_modules.php (+4 -6)
📝 modules/core/setup.php (+1 -1)
📝 modules/feeds/hm-feed.php (+4 -0)
📝 modules/feeds/modules.php (+7 -13)
📝 modules/feeds/setup.php (+2 -2)
📝 modules/gmail_contacts/modules.php (+1 -1)
📝 modules/imap/functions.php (+7 -8)
📝 modules/imap/handler_modules.php (+16 -33)
📝 modules/imap/hm-imap.php (+4 -0)
📝 modules/imap/output_modules.php (+18 -18)

...and 21 more files

📄 Description

An MR to fix once and for all the problem of ids in the cypht, in addition to facilitating all the management and access of entities in each module.

Repository Layer for Modules

All registered and active modules will have an automatically initialized repository. This repository contains all the base resources needed to add, remove, edit and search for objects stored in the session.

github.com/jasonmunro/cypht@9b3e9f7236/modules/profiles/modules.php (L130)

The profiles modules search for a profile on its repository using findById. The repository is automatically injected into the module handler. No additional configuration or instances is necessary.

Fully implemented Profile module

I refactored the entire profiles module to work with this implementation and now I'm implementing it in the other modules. This will remove a lot of duplicate code.

Below is the new code for inserting a profile and how it was before:

Before

github.com/jasonmunro/cypht@07605067db/modules/profiles/modules.php (L117-L147)

After

github.com/jasonmunro/cypht@9c001c3379/modules/profiles/modules.php (L118-L137)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cypht-org/cypht/pull/625 **Author:** [@henrique-borba](https://github.com/henrique-borba) **Created:** 9/23/2022 **Status:** ✅ Merged **Merged:** 2/16/2024 **Merged by:** [@kroky](https://github.com/kroky) **Base:** `master` ← **Head:** `fix/smtp_server_unique_ids` --- ### 📝 Commits (10+) - [`308eced`](https://github.com/cypht-org/cypht/commit/308eced49dc03667234b695b8767082f4ca83093) fix double require of hm-profiles.php file in profiles and nux modules - [`4f7dd1c`](https://github.com/cypht-org/cypht/commit/4f7dd1ca9a9cdee86b31a40eaedaf26cacc58c5f) SMTP servers unique ids - [`caea86c`](https://github.com/cypht-org/cypht/commit/caea86cb2167270ba04514deb9aa7c828928affe) All other id entities (JMAP, Feeds, Profiles...) - [`bd27371`](https://github.com/cypht-org/cypht/commit/bd2737113febd612a1e7ab17abdb2b7d882bd30a) Hotfix profiles ids - [`1da06d5`](https://github.com/cypht-org/cypht/commit/1da06d57ccf45d6e6f7603d0acb8cd7561bdcec4) Repository layer for Handlers and centralized entity and id management - [`180ce61`](https://github.com/cypht-org/cypht/commit/180ce61b7e6eded160c739af4be90fba79379dad) Profile use setDefault method - [`ce62109`](https://github.com/cypht-org/cypht/commit/ce621090672367703f7f466cfbeed77f38b3d254) migrate profiles, imap/smtp/feed server list to repository trait with unique ID management to get rid of array index integer values mixing up when deleting entries - [`9abc745`](https://github.com/cypht-org/cypht/commit/9abc74592762c701f7fe5d6e6605831ef974c108) fix tests after repository ID changes and bootstrap switch - [`48d5abe`](https://github.com/cypht-org/cypht/commit/48d5abef118dff67c24d98931c7bdc54a62da54f) make local contacts use repository pattern and integrate with remote contacts - [`d708645`](https://github.com/cypht-org/cypht/commit/d708645eaca96e9715aa938a621c31c30511611e) repository IDs migration script ### 📊 Changes **41 files changed** (+630 additions, -446 deletions) <details> <summary>View changed files</summary> 📝 `config/app.php` (+0 -9) 📝 `lib/framework.php` (+1 -0) 📝 `lib/module.php` (+1 -0) 📝 `lib/modules.php` (+13 -0) ➕ `lib/repository.php` (+147 -0) 📝 `lib/servers.php` (+17 -28) 📝 `modules/carddav_contacts/hm-carddav.php` (+5 -8) 📝 `modules/contacts/hm-contacts.php` (+45 -25) 📝 `modules/contacts/modules.php` (+1 -0) 📝 `modules/contacts/setup.php` (+2 -2) 📝 `modules/core/handler_modules.php` (+4 -6) 📝 `modules/core/setup.php` (+1 -1) 📝 `modules/feeds/hm-feed.php` (+4 -0) 📝 `modules/feeds/modules.php` (+7 -13) 📝 `modules/feeds/setup.php` (+2 -2) 📝 `modules/gmail_contacts/modules.php` (+1 -1) 📝 `modules/imap/functions.php` (+7 -8) 📝 `modules/imap/handler_modules.php` (+16 -33) 📝 `modules/imap/hm-imap.php` (+4 -0) 📝 `modules/imap/output_modules.php` (+18 -18) _...and 21 more files_ </details> ### 📄 Description An MR to fix once and for all the problem of ids in the cypht, in addition to facilitating all the management and access of entities in each module. ## Repository Layer for Modules All registered and active modules will have an automatically initialized repository. This repository contains all the base resources needed to add, remove, edit and search for objects stored in the session. https://github.com/jasonmunro/cypht/blob/9b3e9f7236fd0d11b8b6d3c27f1215bc22d46e6b/modules/profiles/modules.php#L130 > The profiles modules search for a profile on its repository using **findById**. The repository is automatically injected into the module handler. No additional configuration or instances is necessary. ## Fully implemented Profile module I refactored the entire profiles module to work with this implementation and now I'm implementing it in the other modules. This will remove a lot of duplicate code. Below is the new code for inserting a profile and how it was before: ### Before https://github.com/jasonmunro/cypht/blob/07605067dbc996c0f5d9e5ffe512c36aa4f85886/modules/profiles/modules.php#L117-L147 ### After https://github.com/jasonmunro/cypht/blob/9c001c33799e806474b253c7ebdc757806c35279/modules/profiles/modules.php#L118-L137 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-25 21:36:42 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#938
No description provided.