I tried to post this earlier, but SF was down and I had to
go to class :P
I have applied the factory pattern to the main GedcomRecord
class so that we can get an instance of any object type
without knowing before hand what type of object it is.
So we can ask for
$obj = GedcomRecord::getInstance("R1");
Which will return a generic GedcomRecord object for a
repository but will return a Person object if we ask for a
person.
If you know what type of record you want then you should use
the getInstance method of that class as it will be faster.
For example if you know you want a person you should ask for
it using the Person::getInstance() instead of the
GedcomRecord::getInstance() as Person::getInstance() will be
faster. But if you don't know or don't care what type it
is, as in this case then we can use the generic
GedcomRecord::getInstance()
--John
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=634811
Same problem exists on the source page.
Logged In: YES
user_id=1006499
Fixed for source page :
gedrecord.php
source_class.php
And same problem exists on the REPO page.
Not yet fixed...
Logged In: YES
user_id=634811
Maybe this should be moved to the base GedcomRecord object
so there will not have to be checks for each type.
Logged In: YES
user_id=634811
Actually I just had a look at SVN and CVS it looks like John
has already implementid the use of the base class to fix this.
Logged In: YES
user_id=300048
I tried to post this earlier, but SF was down and I had to
go to class :P
I have applied the factory pattern to the main GedcomRecord
class so that we can get an instance of any object type
without knowing before hand what type of object it is.
So we can ask for
$obj = GedcomRecord::getInstance("R1");
Which will return a generic GedcomRecord object for a
repository but will return a Person object if we ask for a
person.
If you know what type of record you want then you should use
the getInstance method of that class as it will be faster.
For example if you know you want a person you should ask for
it using the Person::getInstance() instead of the
GedcomRecord::getInstance() as Person::getInstance() will be
faster. But if you don't know or don't care what type it
is, as in this case then we can use the generic
GedcomRecord::getInstance()
--John