Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Call to a member function id() on string in #1

Open
ghost opened this issue Jan 2, 2022 · 3 comments
Open

Uncaught Error: Call to a member function id() on string in #1

ghost opened this issue Jan 2, 2022 · 3 comments

Comments

@ghost
Copy link

ghost commented Jan 2, 2022

Hi.

I want to show the relationships between 2 people for my visitors, but when I use _relationship, I get the following error:

Fatal error: Uncaught Error: Call to a member function id() on string in /var/www/html/genealogy/Person.php:628 Stack trace: #0 /var/www/html/genealogy/index.php(243): Person->_relationship() #1 {main} thrown in /var/www/html/genealogy/Person.php on line 628

I use the following:

foreach($gedcom['INDI'] AS $person) {
	$person = new Person($person, $gedcom);
	echo $person->_relationship('Alfred Johansson');
}

I get the same error message when I try to replace $person->_relationship('Alfred Johansson'); with $person->relationship(['Alfred Johansson','Anders Karlsson']);

How to resolve?

@pauly
Copy link
Owner

pauly commented Jan 3, 2022 via email

@pauly
Copy link
Owner

pauly commented Jan 3, 2022 via email

@ghost
Copy link
Author

ghost commented Jan 3, 2022

been a while since I looked at this code but you need to pass an array of objects as a param there, not just their name foreach ($gedcom['INDI'] AS $person) { $person = new Person($person, $gedcom); echo $person->_relationship([$person->mother()->father()->mother()]); }

Thank you for your reply. Unfortunately, that solution didn't work either 😕 I get the same error.

I rewrote this in javascript about five years ago I can probably support that a bit better as that's what I'm using to generate my own website http://www.clarkeology.com

Yeah, I have starred that repo too 🙂 I'll give it a go when I have more time, but I would prefer to use as less JavaScript as possible (don't ask me why, haha).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant