So far, our library had a short memory.
Books lived in the browser session. Another visitor did not see the same list, and an expired session could erase everything. A database keeps records independently from a page or visitor.
A database resembles a well-run library
A catalog devoted to one kind of thing, here books.
One specific book stored in the catalog.
A shared piece of information: title, author, date.
The unique identifier distinguishing two books.
A data journey
Form → Controller → Book entity → DbContext → SQLite
SQLite → DbSet<Book> → Controller → ViewPHPAML Data does not replace the database: it translates between PHP objects and storage. This layer is called an ORM, for Object-Relational Mapping.
VOCABULARY
Words to remember
SUMMARY
What to remember
- A session belongs to a visit; a database belongs to the app.
- A table holds rows structured into columns.
- PHPAML Data connects PHP objects to storage.
- A migration evolves structure reproducibly.