Back to UCMContent class

Method store

protected bool
store
(mixed $data, \Joomla\CMS\Table\TableInterface $table = null, mixed $primaryKey = null)
Store data to the appropriate table
Parameters
  • array $data Data to be stored
  • \Joomla\CMS\Table\TableInterface $table Table Object
  • bool $primaryKey Flag that is true for data that are using #__ucm_content as their primary table
Returns
  • bool true on success
Since
  • 3.1
Class: UCMContent
Project: Joomla

Method store - Source code

/**
 * 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);
}