Skip to content

Repository Entity pattern

Greg Bowler edited this page May 9, 2026 · 2 revisions
  • Explain how larger WebEngine applications benefit from a clearer domain and data access model.
  • Position this as an architectural option rather than a framework requirement.

Entities

  • Explain entities as domain objects representing core application data.
  • Explain how behaviour can live alongside state.
  • Explain with examples how an Entity can be a DTO and then have its own functionality, such as advanced "getters" based on its own state.
  • Show how Entity functions can be given the #[BindGetter] attribute.

Repositories

  • Explain repositories as the boundary for loading and saving entities.
  • Explain how this keeps SQL and persistence concerns out of page logic.
  • Explain that ORMs can be the Repository, and that PHP.GT/Orm is in development.

How this fits in WebEngine applications

  • Page logic calls application classes.
  • Application classes coordinate repositories and entities.
  • Views receive bindable data rather than database rows everywhere.

Relationship to Orm

  • Explain that Orm is intended to support this style more directly in future.
  • Clarify that it is still work in progress and not part of the released documentation set yet.

Clone this wiki locally