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

Remove $chado member variable from the ChadoIdSpace #242

Closed
spficklin opened this issue Jun 28, 2022 · 3 comments
Closed

Remove $chado member variable from the ChadoIdSpace #242

spficklin opened this issue Jun 28, 2022 · 3 comments

Comments

@spficklin
Copy link
Member

There is a $chado member variable that gets set with the Chado connection object during the constructor of the ChadoIdSpace class. However, I found out that if you want to use Ajax in forms you get an error message if there is a connection object in any class stored in the form. Since we never know when an instance of the ChadoIdSpace could be housed in the form we should remove it as a member variable and just get the connection object in the functions.

@laceysanderson
Copy link
Member

Storing the connection in the class in that manner is a Drupal convention so I'm surprised it causes errors in that manner... what is the error that you get?

@laceysanderson
Copy link
Member

As pointed out by @spficklin, this issue has been fixed in per #271. It was also causing errors in the automated testing. I simply removed it and re-initiated the database connection object in each method needing it. I decided on this approach since Tripal DBX had been shown to have some difficulties with stored database connections anyway. Additionally further investigation implies dependency injection might be another route we could take in the future and may be how Drupal is getting around these types of errors.

@spficklin
Copy link
Member Author

@laceysanderson that's the exact same approach I've taken in other places too, so we're consistent!

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

No branches or pull requests

2 participants