public function addAutoTablesConfig(AutoTablesConfiguration $config, $selector)
 {
     $columnOverwrite = util::array_get($config->getColumns()[$selector]);
     if ($columnOverwrite) {
         $this->readOnly = util::array_get($columnOverwrite['readOnly'], $this->readOnly);
         $this->name = util::array_get($columnOverwrite['name'], $this->name);
         $this->type = util::array_get($columnOverwrite['type'], $this->type);
         $this->order = util::array_get($columnOverwrite['order'], $this->order);
         $this->ignore = util::array_get($columnOverwrite['ignore'], $this->ignore);
         $this->visible = util::array_get($columnOverwrite['visible'], $this->visible);
         $this->viewType = util::array_get($columnOverwrite['viewType'], $this->viewType);
         $this->values = util::array_get($columnOverwrite['values'], $this->values);
         $initializer = util::array_get($columnOverwrite['initializer'], null);
         if ($initializer) {
             if (!$this->initializer) {
                 $this->initializer = new InitializerInfo();
             }
             $this->initializer->addInitializerConfig($initializer);
         }
     }
 }
 /**
  * Returns the CrudService according to the given config.
  * @return AutoTablesCrudService
  */
 public function fetchCrudService(AutoTablesConfiguration $config)
 {
     if ($config->getServiceId()) {
         $this->logger->info(sprintf('Create CrudService from serviceId [%s]', $config->getServiceId()));
         $crudService = $this->get($config->getServiceId());
         Ensure::isNotNull($crudService, 'No service [%s] found', $crudService);
         Ensure::isTrue($crudService instanceof AutoTablesCrudService, 'Service [%s] has to implement %s', $config->getServiceId(), 'AutoTablesCrudService');
     } else {
         $this->logger->info(sprintf('Create CrudService from repositoryId [%s]', $config->getRepositoryId()));
         Ensure::isNotEmpty($config->getRepositoryId(), 'Neither [serviceId] nor [repositoryId] defined for datatables of type [%s]', $config->getId());
         $repository = $this->doctrine->getRepository($config->getRepositoryId());
         Ensure::isNotNull($repository, 'Repository with id [%s] not found', $config->getRepositoryId());
         $crudService = new RepositoryAutoTablesCrudService($this->doctrine->getManager(), $repository);
     }
     return $crudService;
 }
 private function mergeColumnsConfiguration(AutoTablesConfiguration $config, $args)
 {
     $newColArgs = util::array_get($args['columns'], array());
     foreach ($newColArgs as $newColArg) {
         $selector = $newColArg['selector'];
         Ensure::isNotEmpty($selector, 'Missing selector in column configuration');
         $colArg = util::array_get($config->getColumns()[$selector], null);
         if ($colArg) {
             // overwrite the settings
             $config->putColumn($selector, array_merge($colArg, $newColArg));
         } else {
             // define a new entry
             $config->putColumn($selector, $newColArg);
         }
     }
     return $config;
 }