Esempio n. 1
0
 /**
  * Export L10nResources in the given filename
  * @param string $filePath name of the export file
  */
 public function exportAllL10nResourceList($filePath = '')
 {
     $l10nResourceList = $this->l10nManager->getAllL10nResourceList();
     $output = $this->l10nConverter->convertL10nResourceList($l10nResourceList);
     $f = fopen($filePath, 'w+');
     fwrite($f, $output);
 }
Esempio n. 2
0
 /**
  * @param $idResource
  * @param $idLocalization
  * @return \L10nBundle\Entity\L10nResource
  * @throws \L10nBundle\Exception\ResourceNotFoundException
  */
 protected function getResourceOrFallbackResource($idResource, $idLocalization)
 {
     $resource = $this->l10nManager->getL10nResource($idResource, $idLocalization);
     if (!$resource) {
         $resource = $this->l10nManager->getL10nResource($idResource, $this->fallbackLocalization);
         if (!$resource) {
             throw new ResourceNotFoundException(sprintf('Resource not found for idResource %s and idLocalization %s', $idResource, $idLocalization));
         }
     }
     return $resource;
 }