src/ShopBundle/objects/db/TShopDiscount.class.php
public function ClearCacheOnAllAffectedArticles()
    {
        $iStartOperation = time();
        $aArticleRestrictions = $this->GetMLTIdList('shop_article_mlt');
        foreach ($aArticleRestrictions as $sArticelId) {
            TCacheManager::PerformeTableChange('shop_article', $sArticelId);
        }

        $aCategoryRestrictons = $this->GetMLTIdList('shop_category_mlt');
        $databaseConnection = $this->getDatabaseConnection();
        if (count($aCategoryRestrictons) > 0) {
            $quotedCategoryRestrictions = implode(',', array_map(array($databaseConnection, 'quote'), $aCategoryRestrictons));
            $query = "SELECT `shop_article`.`id`
                    FROM `shop_article`
               LEFT JOIN `shop_article_shop_category_mlt` ON `shop_article`.`id` = `shop_article_shop_category_mlt`.`source_id`
                   WHERE `shop_article`.`shop_category_id` IN ($quotedCategoryRestrictions)
                      OR `shop_article_shop_category_mlt`.`target_id` IN ($quotedCategoryRestrictions)
                GROUP BY `shop_article`.`id`
                 ";
            $tRes = MySqlLegacySupport::getInstance()->query($query);
            while ($aRes = MySqlLegacySupport::getInstance()->fetch_assoc($tRes)) {
                TCacheManager::PerformeTableChange('shop_article', $aRes['id']);
            }
        }

        if (0 === count($aArticleRestrictions) && 0 === count($aCategoryRestrictons)) {
            TCacheManager::PerformeTableChange('shop_article', null);
        }

        $databaseConnection->update($this->table, array(
            'cache_clear_last_executed' => date('Y-m-d H:i:s', $iStartOperation),
        ), array(
            'id' => $this->id,
        ));
    }
public function ClearCacheOnAllAffectedArticles()
    {
        $iStartOperation = time();
        $aArticleRestrictions = $this->GetMLTIdList('shop_article_mlt');
        foreach ($aArticleRestrictions as $sArticelId) {
            TCacheManager::PerformeTableChange('shop_article', $sArticelId);
        }

        $aCategoryRestrictons = $this->GetMLTIdList('shop_category_mlt');
        $databaseConnection = $this->getDatabaseConnection();
        if (count($aCategoryRestrictons) > 0) {
            $quotedCategoryRestrictions = implode(',', array_map(array($databaseConnection, 'quote'), $aCategoryRestrictons));
            $query = "SELECT `shop_article`.`id`
                    FROM `shop_article`
               LEFT JOIN `shop_article_shop_category_mlt` ON `shop_article`.`id` = `shop_article_shop_category_mlt`.`source_id`
                   WHERE `shop_article`.`shop_category_id` IN ($quotedCategoryRestrictions)
                      OR `shop_article_shop_category_mlt`.`target_id` IN ($quotedCategoryRestrictions)
                GROUP BY `shop_article`.`id`
                 ";
            $tRes = MySqlLegacySupport::getInstance()->query($query);
            while ($aRes = MySqlLegacySupport::getInstance()->fetch_assoc($tRes)) {
                TCacheManager::PerformeTableChange('shop_article', $aRes['id']);
            }
        }

        if (0 === count($aArticleRestrictions) && 0 === count($aCategoryRestrictons)) {
            TCacheManager::PerformeTableChange('shop_article', null);
        }

        $databaseConnection->update($this->table, array(
            'cache_clear_last_executed' => date('Y-m-d H:i:s', $iStartOperation),
        ), array(
            'id' => $this->id,
        ));
    }
public function ClearCacheOnAllAffectedArticles ( ) { $ iStartOperation = time ( ) ; $ aArticleRestrictions = $ this -> GetMLTIdList ( 'shop_article_mlt' ) ; foreach ( $ aArticleRestrictions as $ sArticelId ) { TCacheManager :: PerformeTableChange ( 'shop_article' , $ sArticelId ) ; } $ aCategoryRestrictons = $ this -> GetMLTIdList ( 'shop_category_mlt' ) ; $ databaseConnection = $ this -> getDatabaseConnection ( ) ; if ( count ( $ aCategoryRestrictons ) > 0 ) { $ quotedCategoryRestrictions = implode ( ',' , array_map ( array ( $ databaseConnection , 'quote' ) , $ aCategoryRestrictons ) ) ; $ query = "SELECT `shop_article`.`id`
                    FROM `shop_article`
               LEFT JOIN `shop_article_shop_category_mlt` ON `shop_article`.`id` = `shop_article_shop_category_mlt`.`source_id`
                   WHERE `shop_article`.`shop_category_id` IN ($quotedCategoryRestrictions)
                      OR `shop_article_shop_category_mlt`.`target_id` IN ($quotedCategoryRestrictions)
                GROUP BY `shop_article`.`id`
                 " ; $ tRes = MySqlLegacySupport :: getInstance ( ) -> query ( $ query ) ; while ( $ aRes = MySqlLegacySupport :: getInstance ( ) -> fetch_assoc ( $ tRes ) ) { TCacheManager :: PerformeTableChange ( 'shop_article' , $ aRes [ 'id' ] ) ; } } if ( 0 === count ( $ aArticleRestrictions ) && 0 === count ( $ aCategoryRestrictons ) ) { TCacheManager :: PerformeTableChange ( 'shop_article' , null ) ; } $ databaseConnection -> update ( $ this -> table , array ( 'cache_clear_last_executed' => date ( 'Y-m-d H:i:s' , $ iStartOperation ) , ) , array ( 'id' => $ this -> id , ) ) ; }
trigger a clear cache on all related articles.
trigger a clear cache on all related articles .