$result = Adv\YandexBannerTable::delete($bannerId);
					if(!$result->isSuccess())
					{
						$errorsList = $result->getErrorMessages();
						foreach($errorsList as $errorMessage)
						{
							$adminList->AddGroupError($errorMessage, $bannerId);
						}
					}
				}
				catch(Engine\YandexDirectException $e)
				{
					if($e->getCode() == Engine\YandexDirect::ERROR_NOT_FOUND)
					{
						Adv\YandexBannerTable::setSkipRemoteUpdate(true);
						$result = Adv\YandexBannerTable::delete($bannerId);
						if(!$result->isSuccess())
						{
							$errorsList = $result->getErrorMessages();
							foreach($errorsList as $errorMessage)
							{
								$adminList->AddGroupError($errorMessage, $bannerId);
							}
						}
						Adv\YandexBannerTable::setSkipRemoteUpdate(false);
					}
					else
					{
						$adminList->AddGroupError($e->getCode().': '.$e->getMessage());
					}
				}
Exemple #2
0
 /**
  * Deletes all campaign banners.
  *
  * @param Entity\Event $event Event data.
  *
  * @return void
  *
  * @throws Main\ArgumentException
  */
 public static function onAfterDelete(Entity\Event $event)
 {
     $primary = $event->getParameter("primary");
     $engine = self::getEngine();
     $dbRes = YandexBannerTable::getList(array('filter' => array('=CAMPAIGN_ID' => $primary, '=ENGINE_ID' => $engine->getId()), 'select' => array('ID')));
     YandexBannerTable::setSkipRemoteUpdate(true);
     while ($banner = $dbRes->fetch()) {
         YandexBannerTable::delete($banner['ID']);
     }
     YandexBannerTable::setSkipRemoteUpdate(false);
 }