/**
* Insert or update row in ucm_base table
*
* @param boolean $updateNulls True to update fields even if they are null.
* @param boolean $isNew if true, need to insert. Otherwise update.
*
* @return boolean True on success.
*
* @since 3.1
*/
protected function storeUcmBase($updateNulls = true, $isNew = false)
{
// Store the ucm_base row
$db = $this->getDbo();
$query = $db->getQuery(true);
$languageId = ContentHelper::getLanguageId($this->core_language);
// Selecting "all languages" doesn't give a language id - we can't store a blank string in non mysql databases, so save 0 (the default value)
if (!$languageId) {
$languageId = 0;
}
if ($isNew) {
$query->insert($db->quoteName('#__ucm_base'))->columns([$db->quoteName('ucm_id'), $db->quoteName('ucm_item_id'), $db->quoteName('ucm_type_id'), $db->quoteName('ucm_language_id')])->values(implode(',', $query->bindArray([$this->core_content_id, $this->core_content_item_id, $this->core_type_id, $languageId])));
} else {
$query->update($db->quoteName('#__ucm_base'))->set([$db->quoteName('ucm_item_id') . ' = :coreContentItemId', $db->quoteName('ucm_type_id') . ' = :typeId', $db->quoteName('ucm_language_id') . ' = :languageId'])->where($db->quoteName('ucm_id') . ' = :coreContentId')->bind(':coreContentItemId', $this->core_content_item_id, ParameterType::INTEGER)->bind(':typeId', $this->core_type_id, ParameterType::INTEGER)->bind(':languageId', $languageId, ParameterType::INTEGER)->bind(':coreContentId', $this->core_content_id, ParameterType::INTEGER);
}
$db->setQuery($query);
return $db->execute();
}