diff --git a/administrator/components/com_banners/tables/banner.php b/administrator/components/com_banners/tables/banner.php index 75576947f46f1..eadd70c12f4b7 100644 --- a/administrator/components/com_banners/tables/banner.php +++ b/administrator/components/com_banners/tables/banner.php @@ -173,6 +173,8 @@ public function bind($array, $ignore = array()) */ public function store($updateNulls = false) { + $db = $this->getDbo(); + if (empty($this->id)) { $purchaseType = $this->purchase_type; @@ -180,7 +182,7 @@ public function store($updateNulls = false) if ($purchaseType < 0 && $this->cid) { /** @var BannersTableClient $client */ - $client = JTable::getInstance('Client', 'BannersTable'); + $client = JTable::getInstance('Client', 'BannersTable', array('dbo' => $db)); $client->load($this->cid); $purchaseType = $client->purchase_type; } @@ -220,7 +222,7 @@ public function store($updateNulls = false) { // Get the old row /** @var BannersTableBanner $oldrow */ - $oldrow = JTable::getInstance('Banner', 'BannersTable'); + $oldrow = JTable::getInstance('Banner', 'BannersTable', array('dbo' => $db)); if (!$oldrow->load($this->id) && $oldrow->getError()) { @@ -229,7 +231,7 @@ public function store($updateNulls = false) // Verify that the alias is unique /** @var BannersTableBanner $table */ - $table = JTable::getInstance('Banner', 'BannersTable'); + $table = JTable::getInstance('Banner', 'BannersTable', array('dbo' => $db)); if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { diff --git a/administrator/components/com_contact/tables/contact.php b/administrator/components/com_contact/tables/contact.php index cc137a712b4a5..6b837e791f510 100644 --- a/administrator/components/com_contact/tables/contact.php +++ b/administrator/components/com_contact/tables/contact.php @@ -110,7 +110,7 @@ public function store($updateNulls = false) $this->webpage = JStringPunycode::urlToPunycode($this->webpage); // Verify that the alias is unique - $table = JTable::getInstance('Contact', 'ContactTable'); + $table = JTable::getInstance('Contact', 'ContactTable', array('dbo' => $this->_db)); if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { diff --git a/administrator/components/com_finder/tables/filter.php b/administrator/components/com_finder/tables/filter.php index 524ce6c6c20bf..c9bd00bbe63cc 100644 --- a/administrator/components/com_finder/tables/filter.php +++ b/administrator/components/com_finder/tables/filter.php @@ -240,7 +240,7 @@ public function store($updateNulls = false) } // Verify that the alias is unique - $table = JTable::getInstance('Filter', 'FinderTable'); + $table = JTable::getInstance('Filter', 'FinderTable', array('dbo' => $this->_db)); if ($table->load(array('alias' => $this->alias)) && ($table->filter_id != $this->filter_id || $this->filter_id == 0)) { diff --git a/administrator/components/com_newsfeeds/tables/newsfeed.php b/administrator/components/com_newsfeeds/tables/newsfeed.php index f192137906b30..5a0085c0c3fad 100644 --- a/administrator/components/com_newsfeeds/tables/newsfeed.php +++ b/administrator/components/com_newsfeeds/tables/newsfeed.php @@ -149,7 +149,7 @@ public function store($updateNulls = false) } // Verify that the alias is unique - $table = JTable::getInstance('Newsfeed', 'NewsfeedsTable'); + $table = JTable::getInstance('Newsfeed', 'NewsfeedsTable', array('dbo' => $this->_db)); if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { diff --git a/administrator/components/com_users/tables/note.php b/administrator/components/com_users/tables/note.php index a608c562c5a03..e8a644d4a2563 100644 --- a/administrator/components/com_users/tables/note.php +++ b/administrator/components/com_users/tables/note.php @@ -52,7 +52,7 @@ public function store($updateNulls = false) if (!((int) $this->review_time)) { // Null date. - $this->review_time = JFactory::getDbo()->getNullDate(); + $this->review_time = $this->_db->getNullDate(); } if (empty($this->id)) diff --git a/libraries/src/Table/Content.php b/libraries/src/Table/Content.php index 31b6a3dd25dfc..f600549c2579b 100644 --- a/libraries/src/Table/Content.php +++ b/libraries/src/Table/Content.php @@ -294,7 +294,7 @@ public function check() protected function getDefaultAssetValues($component) { // Need to find the asset id by the name of the component. - $db = \JFactory::getDbo(); + $db = $this->getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) diff --git a/libraries/src/Table/Menu.php b/libraries/src/Table/Menu.php index 45c434f797c8d..d85c6922f18cd 100644 --- a/libraries/src/Table/Menu.php +++ b/libraries/src/Table/Menu.php @@ -144,10 +144,10 @@ public function check() */ public function store($updateNulls = false) { - $db = \JFactory::getDbo(); + $db = $this->getDbo(); // Verify that the alias is unique - $table = Table::getInstance('Menu', 'JTable', array('dbo' => $this->getDbo())); + $table = Table::getInstance('Menu', 'JTable', array('dbo' => $db)); $originalAlias = trim($this->alias); $this->alias = !$originalAlias ? $this->title : $originalAlias; @@ -227,7 +227,7 @@ public function store($updateNulls = false) // The alias already exists. Enqueue an error message. if ($error) { - $menuTypeTable = Table::getInstance('MenuType', 'JTable', array('dbo' => $this->getDbo())); + $menuTypeTable = Table::getInstance('MenuType', 'JTable', array('dbo' => $db)); $menuTypeTable->load(array('menutype' => $table->menutype)); $this->setError(\JText::sprintf('JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS', $this->alias, $table->title, $menuTypeTable->title));