示例#1
0
 /**
  * @param $customLanguage
  * @return array|null
  */
 public function formatCustomLanguage(CustomLanguage $customLanguage)
 {
     if (empty($customLanguage)) {
         return null;
     } else {
         return array("customLanguage" => json_decode($customLanguage->getCustomLanguage()));
     }
 }
示例#2
0
 /**
  * @param $accountId
  * @param $customLanguage
  * @throws \Exception
  */
 public function saveCustomLanguage($accountId, $customLanguage)
 {
     try {
         if (self::existCustomLanguage($accountId)) {
             $customLanguageTemp = self::getCustomLanguage($accountId);
             $customLanguageTemp->setCustomLanguage($customLanguage);
             $this->getPixiepadEntityManager()->merge($customLanguageTemp);
             $this->getPixiepadEntityManager()->flush();
         } else {
             $customLanguageTemp = new CustomLanguage();
             $customLanguageTemp->setAccountId($accountId);
             $customLanguageTemp->setCustomLanguage($customLanguage);
             $this->getPixiepadEntityManager()->persist($customLanguageTemp);
             $this->getPixiepadEntityManager()->flush();
         }
     } catch (\Exception $ex) {
         throw new \Exception($ex->getMessage());
     }
 }