Persistence layer in Extbase 

The persistence layer is where Extbase turns database rows into domain objects and writes your changes. Once your models and repositories exist, this chapter is about using them well: querying for the right records, setting which pages and languages a query covers, loading all related objects, and knowing the performance trade-offs before they bite.

This chapter assumes you already have a model and a repository. If you do not, start with the domain chapter:

The pages in this chapter cover:

Querying the database with Extbase
Everything around a query: how to create, constrain and execute them, query settings (language, enable fields, deleted records), limiting, ordering and pagination, when changes reach the database with persistAll(), and how to debug a query by inspecting its SQL.
The storagePid: where Extbase looks for records
The storagePid — the page restriction Extbase applies to every query, and the most common reason a query does not return what you expect. The resolution chain, the recursive setting, and how to override or drop the restriction for a single query.
Object relations in Extbase
The two relation shapes — a relation to one object and a relation to many — and how each is stored, how Extbase loads related objects, and the lazy loading versus N+1 query trade-off that decides the performance of a list view with relations.