/**
* Update an existing association with a new state
*
* @param array $pks An Array of item IDs which should be changed
* @param integer $state The new state ID
*
* @return boolean
*
* @since 4.0.0
*/
public function updateAssociations(array $pks, int $state) : bool
{
$pks = ArrayHelper::toInteger($pks);
try {
$query = $this->db->getQuery(true);
$query->update($this->db->quoteName('#__workflow_associations'))->set($this->db->quoteName('stage_id') . ' = :state')->whereIn($this->db->quoteName('item_id'), $pks)->where($this->db->quoteName('extension') . ' = :extension')->bind(':state', $state, ParameterType::INTEGER)->bind(':extension', $this->extension);
$this->db->setQuery($query)->execute();
} catch (\Exception $e) {
return false;
}
return true;
}