/**
* Link the given image with the given article. The template ID
* is the image's position in the template.
*
* @param int $p_imageId
* @param int $p_articleNumber
* @param int $p_templateId
* Optional. If not specified, this will be the next highest number
* of the existing values.
*
* @return void
*/
public static function AddImageToArticle($p_imageId, $p_articleNumber, $p_templateId = null)
{
global $g_ado_db;
if (is_null($p_templateId)) {
$p_templateId = ArticleImage::GetUnusedTemplateId($p_articleNumber);
}
$queryStr = 'INSERT IGNORE INTO ArticleImages(NrArticle, IdImage, Number)' . ' VALUES(' . $p_articleNumber . ', ' . $p_imageId . ', ' . $p_templateId . ')';
$g_ado_db->Execute($queryStr);
$cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
$cacheService->clearNamespace('article_image');
}