View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000728 | XMB1 | New Features | public | 2024-12-12 09:04 | 2024-12-17 05:51 |
Reporter | miqrogroove | Assigned To | miqrogroove | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | confirmed | Resolution | open | ||
Target Version | 1.10.00 | ||||
Summary | 0000728: Dependency Injection Patterns | ||||
Description | There are several variables I would like to de-couple from the global namespace: $db $serror $SETTINGS $THEME $lang $self $session Each of these is a different use case with different consequences to global coding changes. The goal here is to figure out which alternative patterns could be best for XMB. | ||||
Tags | No tags attached. | ||||
MySQL Version | |||||
PHP Version | |||||
Web Server | |||||
Browser | |||||
Flags | |||||
Original Reporter | |||||
SVN Revision | |||||
|
The first reference to $db in functions.inc.php doesn't do anything. That can be cleaned up as part of this. |
|
The one reference to $db in sessions.inc.php can be easily factored out by returning an array instead of a mysqli_result. |
|
A big disadvantage to the DI pattern is that without autowiring, essentially the entire project has to be taken out of global scope. Otherwise, there's no way to pass the dependencies without handling them as globals at some point, which seems counterproductive. That means one advantage to just using singletons or service locators is that they can be called directly from existing functions without restructuring the entire project. |
|
Working with a combination of DI and static service references. |
Date Modified | Username | Field | Change |
---|---|---|---|
2024-12-12 09:04 | miqrogroove | New Issue | |
2024-12-13 17:20 | miqrogroove | Note Added: 0000529 | |
2024-12-13 17:20 | miqrogroove | Note Edited: 0000529 | |
2024-12-13 17:24 | miqrogroove | Note Edited: 0000529 | |
2024-12-13 19:27 | miqrogroove | Note Added: 0000530 | |
2024-12-13 22:04 | miqrogroove | Note Added: 0000531 | |
2024-12-14 09:59 | miqrogroove | Severity | tweak => feature |
2024-12-14 09:59 | miqrogroove | Status | new => acknowledged |
2024-12-14 09:59 | miqrogroove | Category | Research Tasks => New Features |
2024-12-14 09:59 | miqrogroove | Target Version | => 1.10.00 |
2024-12-17 05:51 | miqrogroove | Assigned To | => miqrogroove |
2024-12-17 05:51 | miqrogroove | Status | acknowledged => confirmed |
2024-12-17 05:51 | miqrogroove | Note Added: 0000532 |