View Issue Details

IDProjectCategoryView StatusLast Update
0000728XMB1New Featurespublic2024-12-17 05:51
Reportermiqrogroove Assigned Tomiqrogroove  
PrioritynormalSeverityfeatureReproducibilityN/A
Status confirmedResolutionopen 
Target Version1.10.00 
Summary0000728: Dependency Injection Patterns
DescriptionThere 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.
TagsNo tags attached.
MySQL Version
PHP Version
Web Server
Browser
Flags
Original Reporter
SVN Revision

Activities

miqrogroove

2024-12-13 17:20

administrator   ~0000529

Last edited: 2024-12-13 17:24

The first reference to $db in functions.inc.php doesn't do anything. That can be cleaned up as part of this.

miqrogroove

2024-12-13 19:27

administrator   ~0000530

The one reference to $db in sessions.inc.php can be easily factored out by returning an array instead of a mysqli_result.

miqrogroove

2024-12-13 22:04

administrator   ~0000531

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.

miqrogroove

2024-12-17 05:51

administrator   ~0000532

Working with a combination of DI and static service references.

Issue History

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