30
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-06-01 22:10:50 +00:00

Use correct database (#391)

Suppose you're not operating on the default Joomla database (the one returned by `JFactory::getDbo()`) but on another one entirely? In theory, it is possible. In that case, you will want this new table object to use the same DBO that `$this` is using. 

If you look at any similar table classes that are built in to Joomla, you will see this same kind of thing. So this is consistent with Joomla practices.
This commit is contained in:
Elijah Madden 2019-03-15 21:24:27 +09:00 committed by George Wilson
parent 8574a4f3cf
commit 802cff4ae8

View File

@ -91,7 +91,7 @@ class WeblinksTableWeblink extends JTable
}
// Verify that the alias is unique
$table = JTable::getInstance('Weblink', 'WeblinksTable');
$table = JTable::getInstance('Weblink', 'WeblinksTable', array('dbo' => $this->getDbo()));
if ($table->load(array('language' => $this->language, 'alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0))
{