This part is tricky. You will need two databases and some custom code that is able to operate on both of them. Let's say you create an instance of JTableContent
, it registers a JTableObserverTags
to handle some stuff related to tags. This, in turn, uses a JHelperTags
to store, delete, etc. So, for example, lets say you have two Joomla! installations, A and B. A has a custom component that access B's database, get an instance of JTableContent
and manipulate that in some way. When it saves or performs some other observable operation, JHelperTags
may be called upon to do something with B's tags but some of its functions will be operating on A's database while others will operate on B's. The most likely result is that you will lose some tag associations from the article you're working on but other, worse issues may also be possible.
Well, you'd expect that when you perform some operation on B's content, tag associations will not be lost or corrupted or whatever.
You may lose tag associations, you may have other problems.
Well, not really relevant except that this could only occur if you're working on more than one database.
Yes, I know this is quite obscure. It is, nevertheless, a real issue.
I think so too but it's not so straight forward. JHelperTags
has some functions which take an instance of some JTable
class as an argument. In those cases, it probably uses the dbo from the table class. In cases where no JTable
is passed in, it uses the default one from JFactory
.
If we give JHelperTags
its own reference to the dbo that we want it to use, it's obvious that we should use it instead of the default but it's less obvious what to do when a JTable
class is being passed in. Hopefully the JTable
and JHelperTags
will be using the same dbo. If they are not, should we throw an exception or something? Basically nothing good can come of the situation where you create a JHelperTags
with a specific dbo but then tell it to operate (in some case) on a JTable
with a different dbo. So I think there should be a check for this where applicable and probably an exception should be thrown.
Category | ⇒ | Tags |
Labels |
Added:
?
|
Hello @okonomiyaki3000
Thank you for your contribution.
The last comment here was on December 13, 2014. So the question is, Is this issue/pull request still valid? If so, could you do a pull request for this?
If no reply is received within 4 weeks we will close this issue.
Thanks for understanding!
Status | New | ⇒ | Information Required |
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-01-18 13:19:23 |
Closed_By | ⇒ | brianteeman |
Closed as per the comment above
Only way around this would be to refactor JHelperTags and its callers so that a JDatabaseDriver instance could optionally be injected (use the one from JFactory if an object isn't injected).