How to Load Data from Database into Custom Files (v2025)

Short answer

It is recommended NOT to use this approach anymore.

For v2026, read Migrating to v2026 -> Route/API Action Server Events Replaced by Route/API Action Controllers.

Long Answer

v2026 uses Symfony, it follows a strict modern architecture. Manually including files is now essentially trying to run code outside of the framework's "brain."

Here is why you should avoid that old approach:

  • The Kernel isn't Booted: Symfony uses a Service Container to manage everything (database, security, sessions). If you just include files manually, the "Kernel" doesn't boot. This means global functions won't work because their services aren't "awake."
  • Broken Security: PHPMaker/Symfony’s security only protects routes it knows about. By using a standalone file, you bypass the framework's gatekeeper, making it much harder to safely verify if a user is logged in or has the right permissions.
  • Audit & Logging Issues: Advanced features like Audit Trails rely on the framework being fully initialized to write to your database. Without the proper Symfony context, these features either break or default to basic text logs.
  • Path Fragility: PHPMaker/Symfony projects have a specific directory structure. Hardcoding paths to src/ or vendor/ is a maintenance nightmare; if the framework updates or moves a file, your custom script will immediately break.

The better way: Use Controller_Action Server Event or Route/API acton controllers. This registers your code as a proper route. The framework boots up completely, giving you full, safe access to every feature automatically.