-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Persistence in PHP with Doctrine ORM
By :
Like all object-oriented programming languages, PHP is designed on top of the inheritance concept; however, relational databases are not. This is the common problem when mapping classes to tables.
The Doctrine ORM provides the following three ways to achieve inheritance:
Mapped Superclasses
Single Table Inheritance
Class Table Inheritance
To learn about them, we will create three implementations of the same model, that is, for content authors.
Both posts and comments have authors. Authors must have a name and an e-mail address. Posts' authors (and only them) can also have an optional biography.
To represent this, we will create two classes: PostAuthor and CommentAuthor. They both extend an abstract Author class. Each Comment entity is linked to a CommentAuthor class and each Post entity to a PostAuthor class.
Mapped Superclasses are simple PHP classes that share mapped properties used by their descendant entities. Mapped Superclasses are not entities...
Change the font size
Change margin width
Change background colour