Remove $chado member variable from the ChadoIdSpace
spficklin opened this issue · 3 comments
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.
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?
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.
@laceysanderson that's the exact same approach I've taken in other places too, so we're consistent!