From 802cff4ae81d5902b0d2b230634321d93155f316 Mon Sep 17 00:00:00 2001 From: Elijah Madden Date: Fri, 15 Mar 2019 21:24:27 +0900 Subject: [PATCH] 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. --- src/administrator/components/com_weblinks/tables/weblink.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/administrator/components/com_weblinks/tables/weblink.php b/src/administrator/components/com_weblinks/tables/weblink.php index a7910ec..a4963fb 100644 --- a/src/administrator/components/com_weblinks/tables/weblink.php +++ b/src/administrator/components/com_weblinks/tables/weblink.php @@ -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)) {