Skip to content

Version 3 - (╯°□°)╯︵ ┻━┻#25

Merged
hparadiz merged 6 commits into
releasefrom
develop
Mar 26, 2026
Merged

Version 3 - (╯°□°)╯︵ ┻━┻#25
hparadiz merged 6 commits into
releasefrom
develop

Conversation

@hparadiz
Copy link
Copy Markdown
Collaborator

PR Summary

This PR completes the v3 ORM/runtime refactor and closes the remaining release-blocking cleanup around model configuration and backend support.

What Changed

  • split the old MySQL-centric database layer into backend-aware runtime pieces:
    • Connections
    • StorageType
    • concrete MySQL and SQLite drivers
    • backend-specific query renderers
    • backend-specific schema writers
  • introduced first-class SQLite support across config, runtime, query rendering, schema generation, and test execution
  • extracted model read/hydration concerns into:
    • Factory
    • ModelMetadata
    • Instantiator
    • EventBinder
    • PrototypeRegistry
  • extracted lifecycle behavior from ActiveRecord into handler classes for save/delete/destroy/before-save/after-save/cache clearing/exception handling
  • reduced per-model boilerplate by making these optional for ordinary models:
    • $rootClass
    • $defaultClass
    • $subClasses
    • $singularNoun
    • $pluralNoun
  • kept explicit metadata support for real polymorphic roots and synthetic test models that intentionally need separate model identities
  • added v3 architecture documentation in docs/v3-architecture.md
  • linked the new architecture doc from the README and added a minimal model example near the top
  • fixed config override loading so config/db.dev.php is resolved relative to config/db.php

Why

The old architecture concentrated too much behavior in ActiveRecord and a single MySQL-oriented DB helper. This PR moves the framework toward explicit layers for:

  • backend resolution
  • query dialect selection
  • schema generation
  • model metadata
  • hydration
  • lifecycle orchestration

That makes the runtime easier to extend, gives SQLite real support instead of partial compatibility, and removes repetitive boilerplate from normal models.

Compatibility Notes

  • normal models no longer need to declare subclass metadata or noun labels unless they are intentionally overriding defaults
  • polymorphic roots like Media should still declare explicit subclass metadata
  • special test doubles or synthetic models that need their own root identity should also keep explicit metadata

Verification

  • composer test passes
  • MySQL: OK (221 tests, 539 assertions)
  • SQLite: OK (221 tests, 545 assertions)

@hparadiz hparadiz force-pushed the develop branch 2 times, most recently from 990af7d to a1fc6eb Compare March 26, 2026 08:14
@hparadiz hparadiz merged commit 9614439 into release Mar 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant