Hello
I'm building a factory for my DAO's and want it to return the correct DAO based on the class of the ValueObject passed to the factory.
Now, if this was java I would use something like this:
if (valueObject instanceof User) {
return new UserDAO();
} else if (valueObject instanceof Profile) {
return new ProfileDAO();
}
or even better: overload my factory method :) But overloading can't be done that way in PHP.
But as far as I know the instanceof function isn't included in PHP5.
Any idea of an elegant way to do this?
-Vidaj-