예제 #1
0
 public function importAction()
 {
     $request = $this->getRequest();
     if (!$request instanceof ConsoleRequest) {
         throw new RuntimeException('You can only use this action from a console!');
     }
     $this->rulesImporter->import($this->params('filePath'));
 }
예제 #2
0
 /**
  * @param ServiceLocatorInterface $serviceLocator
  * @return RulesImporter
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $objectManager = $serviceLocator->get('doctrine.entitymanager.orm_default');
     $service = new RulesImporter($objectManager);
     $config = $serviceLocator->get('config');
     if (!empty($config['rulesections'])) {
         $service->setSections($config['rulesections']);
     }
     return $service;
 }