Web lists-archives.com

Re: [PHP] Missing something ...




On Sun, Dec 27, 2015 at 1:00 PM, Lester Caine <lester@xxxxxxxxxxx> wrote:

> On 27/12/15 16:52, Aziz Saleh wrote:
> > On Sun, Dec 27, 2015 at 11:43 AM, Lester Caine <lester@xxxxxxxxxxx>
> wrote:
> >
> >> Still back on PHP5.6 and it's code that has been working, but I'm not
> >> sure why it's failing now.
> >>
> >> Fatal error: Call to undefined method GedcomRecord::getChildFamilies()
> >>
> >> GedcomRecord is the parent class for the various record elements, and in
> >> this case an instance of Person has been created and initially
> >> populated, but calls to child functions of Person are giving this error.
> >>
> >> $person = Person::getInstance($pid);
> >> print($pid);
> >> print_r($person);
> >> Shows a valid $pid and it's base data, but
> >>
> >> $facts = $person->getIndiFacts();
> >> and
> >> $fams = $person->getChildFamilies();
> >>
> >> which are valid functions in the Person class are not being found and
> >> giving the error. I'm missing something simple, but a fresh mind may
> >> help telling me where to look next.
>
> > What does get_class_methods give you? Does it list those functions part
> of
> > of the list?
>
> Good point ...
> Fatal error: Call to undefined method GedcomRecord::get_class_methods()
>
> So Person::getInstance($pid); IS only returning the data rather than
> creating an instance of the Person class :(
>
> --
> Lester Caine - G8HFL
> -----------------------------
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk
> Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
How does your getInstance() look like, here is a copy of what I usually
have for singletons:

http://sandbox.onlinephpfunctions.com/code/7457951d84ec33ec7de8d11cfc7016f8c398ffc1