In essence, factory functions are class methods that manufacture items or other properties during the instantiation of the class. This article explains pros and cons of factory function and how to use them correctly.
Imagine that you have a one-to-many relationship in your database, for example, you have table person in which you keep personal data (first, middle, last names, etc.) and you have table phone where you keep phone numbers (phone type, phone number).
It is quite common to have person:phones, company:phones, order:items, invoice:items, etc relationships.