item and job are that similiar classes. My question is here, as i said im trying to learn. Am i doing this right? Did i understand factory pattern right? Have any good documents about this(i read everything on php.net, got anything else).

2 Answers
2

First of all , there are two similar structures which are used for object creation:

factories: if object requires some sort of initialization before released for 'consumption'

builders: if before creating object you have to create bunch of other objects

Usually people do not distinguish between the two, and just call them "Factories". So these would be two case where you use a factory.

What you have right now does not fit the description. You are creating some sort of database connection, then getting some data, and then using it for creating a list of objects. This is not a reusable code.

It would be much better if the usage of factory would be something like this :

The extend defines an "is a" relationship. You have to be careful not to write class User extends Table or something as schizophrenic as that.
–
tereškoMar 13 '12 at 23:55

1

After reading tereško's response above, I realized just how much I don't know about design patterns. Ignore my response, it isn't truly a Factory and there is no reason for the Asset class to be a singleton.
–
augustknightMar 15 '12 at 15:44