Example #1
0
 /**
  * sets the settings for the committed shop
  */
 public function setSettingsAction()
 {
     $request = $this->Request();
     $trustedShopsParams = $request->getParams();
     /* @var TrustedShops $trustedShopsModel */
     $trustedShopsModel = $this->getModelManager()->getRepository('Shopware\\CustomModels\\TrustedShops\\TrustedShops')->findOneBy(array('shopId' => $trustedShopsParams['shopId']));
     if ($trustedShopsModel) {
         $trustedShopsModel->fromArray($trustedShopsParams);
     } else {
         $trustedShopsModel = new TrustedShops();
         $trustedShopsModel->fromArray($trustedShopsParams);
     }
     $this->getModelManager()->persist($trustedShopsModel);
     $this->getModelManager()->flush();
     $isExcellence = $this->getSoapApiComponent()->checkCertificateTypeIfExcellence($trustedShopsParams['shopId'], true);
     if (!$isExcellence) {
         $this->getSoapApiComponent()->deleteTrustedShopsArticles();
     }
     $this->View()->assign(array('data' => $trustedShopsParams['shopId'], 'success' => true));
 }