From debc29b6ad8855a5c33d5e20ac9c925001819d20 Mon Sep 17 00:00:00 2001 From: Tomasz Narloch Date: Tue, 5 Jun 2018 19:11:46 +0200 Subject: [PATCH] JTableAsset::loadByName(): replace two sql queries by one --- libraries/src/Table/Asset.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/libraries/src/Table/Asset.php b/libraries/src/Table/Asset.php index 0ff68e7aa2533..9bf3af282d3cd 100644 --- a/libraries/src/Table/Asset.php +++ b/libraries/src/Table/Asset.php @@ -72,19 +72,7 @@ public function __construct($db) */ public function loadByName($name) { - $query = $this->_db->getQuery(true) - ->select($this->_db->quoteName('id')) - ->from($this->_db->quoteName('#__assets')) - ->where($this->_db->quoteName('name') . ' = ' . $this->_db->quote($name)); - $this->_db->setQuery($query); - $assetId = (int) $this->_db->loadResult(); - - if (empty($assetId)) - { - return false; - } - - return $this->load($assetId); + return $this->load(array('name' => $name)); } /**