/**
* Loads an existing association item with state and item ID
*
* @param integer $itemId The item ID to load
*
* @return \stdClass|null
*
* @since 4.0.0
*/
public function getAssociation(int $itemId) : ?\stdClass
{
$query = $this->db->getQuery(true);
$query->select([$this->db->quoteName('a.item_id'), $this->db->quoteName('a.stage_id'), $this->db->quoteName('s.workflow_id')])->from($this->db->quoteName('#__workflow_associations', 'a'))->innerJoin($this->db->quoteName('#__workflow_stages', 's'), $this->db->quoteName('a.stage_id') . ' = ' . $this->db->quoteName('s.id'))->where([$this->db->quoteName('item_id') . ' = :id', $this->db->quoteName('extension') . ' = :extension'])->bind(':id', $itemId, ParameterType::INTEGER)->bind(':extension', $this->extension);
return $this->db->setQuery($query)->loadObject();
}