ORM Indoctrination

By Oscar Merida

This month, let’s examine how to integrate Doctrine ORM 3.x into a standalone, non-Symfony PHP application, like our Spacetraders Web UI. We can let Doctrine ORM handle stock database queries for us so we don’t have to write much, or any, SQL. I’ll cover essential setup patterns, from utilizing PHP 8 attributes and asymmetric visibility (public private(set)) to handling custom Value Objects via custom DBAL mapping types. Finally, I’ll show you how to clean up application controllers by encapsulating query logic inside custom repositories and isolating template-specific view behavior using the Presenter pattern. by Oscar Merida

This article was originally published in the September 2026 issue of PHP Architect magazine. To read the complete article please subscribe or purchase the complete issue.

Leave a comment

Use the form below to leave a comment: