/** * Update the currencies with new columns. * * @param array $content */ protected function updateCurrencies($content) { JLoader::register("CrowdfundingTableCurrency", JPATH_ADMINISTRATOR . "/components/com_crowdfunding/tables/currency.php"); $db = $this->getDbo(); foreach ($content as $item) { $code = Joomla\String\String::trim($item->code); $keys = array("code" => $code); $table = new CrowdfundingTableCurrency($db); $table->load($keys); if (!$table->get("id")) { $table->set("title", Joomla\String\String::trim($item->title)); $table->set("code", $code); $table->set("position", 0); } // Update the symbol if missing. if (!$table->get("symbol") and !empty($item->symbol)) { $table->set("symbol", Joomla\String\String::trim($item->symbol)); } $table->store(); } }
/** * Update the currencies with new columns. * * @param array $content */ protected function updateCurrencies($content) { JLoader::register('CrowdfundingTableCurrency', JPATH_ADMINISTRATOR . '/components/com_crowdfunding/tables/currency.php'); $db = $this->getDbo(); foreach ($content as $item) { $code = JString::trim($item->code); $keys = array('code' => $code); $table = new CrowdfundingTableCurrency($db); $table->load($keys); if (!$table->get('id')) { $table->set('title', JString::trim($item->title)); $table->set('code', $code); $table->set('position', 0); } // Update the symbol if missing. if (!$table->get('symbol') and !empty($item->symbol)) { $table->set('symbol', JString::trim($item->symbol)); } $table->store(); } }