Daycry Doctrine¶
Doctrine ORM 3 integration for CodeIgniter 4 — a configured EntityManager, per-group multi-database support, query/result/metadata caching and Second-Level Cache, a safe server-side DataTables Builder, a debug-toolbar collector and Spark / ORM CLI tooling. Backward-compatible and production-ready.
Features¶
-
EntityManager, your way
Use it as a service, a helper or a plain object.
getEm()with null-guards,reOpen()that actually reconnects a stale worker connection, and SSL / custom DBAL options passthrough. -
Server-side DataTables
Filtering, ordering and pagination with safe operator parsing, whitelisted columns, page-size and filter-value caps,
fetchJoinCollectionopt-out and injectable totals. -
Bracket search operators
Per-column
[%] [=] [!=] [>] [<] [IN] [OR] [><]with case-insensitive support and strict, documented validation —regex: trueis rejected by design. -
Caching & Second-Level Cache
Query / result / metadata caches backed by
Config\Cache, per-group namespacing, thegetFromCacheOrQuery()cache-aside helper, and Doctrine SLC with an optional stats badge. -
:material-database-multiple:{ .lg .middle } Multi-database groups
Every
Config\Databasegroup resolves to its own cached Doctrine instance and isolated cache namespaces — and the ORM CLI can target any group with--em=<group>. -
Extensible by config
Register custom DBAL Types, SQL Filters (soft-delete / multi-tenant), event listeners/subscribers, DBAL middlewares and a default repository class — all re-applied on
reOpen(). -
Debug toolbar & logging
A toolbar collector captures every DBAL query (debug only), with an SLC hit/miss/put badge — plus opt-in PSR-3 production query logging with a slow-query threshold.
-
Spark & ORM CLI
doctrine:publish,doctrine:cache:clear,doctrine:validate,doctrine:info,doctrine:schema:update, plus the full Doctrine ORM console viacli-config.php.
Quick start¶
$doctrine = \Config\Services::doctrine();
$user = $doctrine->em->getRepository(\App\Models\Entity\User::class)->find(1);
See Installation and Configuration to get going, or jump to the DataTables Builder.
Requirements¶
- PHP ≥ 8.2
- CodeIgniter ^4
- Doctrine ORM ^3, DBAL ^4
- Symfony Cache ^7