/**
  * Process the command
  *
  * @return integer
  */
 public function processCommandTask()
 {
     // output message
     $this->console->writeTaskLine('task_generate_factory_writing', array('table gateway'));
     // set factory file
     $factoryFile = $this->params->tableGatewayDir . '/' . $this->params->tableGatewayClassName . 'Factory.php';
     // check if factory file exists
     if (file_exists($factoryFile)) {
         $this->console->writeFailLine('task_generate_factory_exists', array('table gateway', $this->console->colorize($this->params->tableGatewayClassName, Color::GREEN), $this->console->colorize($this->params->paramModule, Color::GREEN)));
         return 1;
     }
     // create class
     $class = new TableGatewayFactoryGenerator($this->params->tableGatewayClassName, $this->params->paramModule, $this->params->config['namespaceTableGateway'], $this->params->paramTableName, $this->params->config);
     // create file
     $file = new ClassFileGenerator($class->generate(), $this->params->config);
     // write file
     file_put_contents($factoryFile, $file->generate());
     return 0;
 }
 /**
  * Process the command
  *
  * @return integer
  */
 public function processCommandTask()
 {
     foreach ($this->params->tableConfig as $tableKey => $tableConfig) {
         // output message
         $this->console->writeTaskLine('task_generate_factory_writing', ['table gateway']);
         // set factory file
         $factoryFile = $this->params->tableGatewayDir . '/' . $tableConfig['tableGatewayClass'] . 'Factory.php';
         // check if factory file exists
         if (file_exists($factoryFile)) {
             $this->console->writeFailLine('task_generate_factory_exists', ['table gateway', $this->console->colorize($tableConfig['tableGatewayClass'], Color::GREEN), $this->console->colorize($this->params->paramModule, Color::GREEN)]);
             return 1;
         }
         // create class
         $class = new TableGatewayFactoryGenerator($tableConfig['tableGatewayClass'], $this->params->paramModule, $tableKey, $this->params->config, $this->params->loadedTables);
         // create file
         $file = new ClassFileGenerator($class->generate(), $this->params->config);
         // write file
         file_put_contents($factoryFile, $file->generate());
     }
     return 0;
 }