コード例 #1
0
 /**
  * shop installed an upgraded version
  * @param UpgradeEvent $event
  * @return bool
  */
 public function onUpgrade(UpgradeEvent $event)
 {
     $shop = $this->getShopByEvent($event);
     if (!$shop) {
         return false;
     }
     // todo: refactor this on major change: push application object thru event
     $appData = $event->getApplication();
     $app = new Application($event->getApplicationName(), $appData['app_id'], $appData['app_secret'], $appData['appstore_secret'], null, $this->skipSsl);
     $app->setUserAgent($appData['user_agent']);
     $this->tokenRefresher->setClient($app->getClient($shop));
     $this->tokenRefresher->refresh($shop);
     $shop->setVersion($event->getPayload()['application_version']);
     $this->objectManager->save($shop);
 }