/**
* Store data to the appropriate table
*
* @param array $data Data to be stored
* @param TableInterface $table Table Object
* @param boolean $primaryKey Flag that is true for data that are using #__ucm_content as their primary table
*
* @return boolean true on success
*
* @since 3.1
*/
protected function store($data, TableInterface $table = null, $primaryKey = null)
{
$table = $table ?: Table::getInstance('Corecontent');
$typeId = $this->getType()->type->type_id;
$primaryKey = $primaryKey ?: $this->getPrimaryKey($typeId, $data['core_content_item_id']);
if (!$primaryKey) {
// Store the core UCM mappings
$baseData = array();
$baseData['ucm_type_id'] = $typeId;
$baseData['ucm_item_id'] = $data['core_content_item_id'];
$baseData['ucm_language_id'] = ContentHelper::getLanguageId($data['core_language']);
if (parent::store($baseData)) {
$primaryKey = $this->getPrimaryKey($typeId, $data['core_content_item_id']);
}
}
return parent::store($data, $table, $primaryKey);
}