diff --git a/administrator/components/com_banners/src/Table/BannerTable.php b/administrator/components/com_banners/src/Table/BannerTable.php index 6c6f1d71168e7..e44f381d02fe8 100644 --- a/administrator/components/com_banners/src/Table/BannerTable.php +++ b/administrator/components/com_banners/src/Table/BannerTable.php @@ -216,6 +216,15 @@ public function store($updateNulls = true) { $db = $this->getDbo(); + // Verify that the alias is unique + $table = new self($db, $this->getDispatcher()); + + if ($table->load(['alias' => $this->alias, 'catid' => $this->catid]) && ($table->id != $this->id || $this->id == 0)) { + $this->setError(Text::_('COM_BANNERS_ERROR_UNIQUE_ALIAS')); + + return false; + } + if (empty($this->id)) { $purchaseType = $this->purchase_type; @@ -261,15 +270,6 @@ public function store($updateNulls = true) $this->setError($oldrow->getError()); } - // Verify that the alias is unique - $table = new self($db, $this->getDispatcher()); - - if ($table->load(['alias' => $this->alias, 'catid' => $this->catid]) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(Text::_('COM_BANNERS_ERROR_UNIQUE_ALIAS')); - - return false; - } - // Store the new row parent::store($updateNulls);