private function askForCreateSP(string $spType, string $tableName): void
  {
    $question = sprintf('Create SP for <dbo>%s</dbo> ? (default Yes): ', $spType);
    $question = new ConfirmationQuestion($question, true);
    if ($this->helper->ask($this->input, $this->output, $question))
    {
      $defaultSpName = strtolower(sprintf('%s_%s', $tableName, $spType));
      $fileName      = sprintf('%s/%s.psql', $this->sourceDirectory, $defaultSpName);

      $question = new Question(sprintf('Please enter filename (%s): ', $fileName), $fileName);
      $spName   = $this->helper->ask($this->input, $this->output, $question);

      if ($spName!==$fileName)
      {
        $spName   = strtolower($spName);
        $fileName = sprintf('%s/%s.psql', $this->sourceDirectory, $spName);
      }
      else
      {
        $spName = $defaultSpName;
      }

      if (file_exists($fileName))
      {
        $this->io->writeln(sprintf('File <fso>%s</fso> already exists', $fileName));
        $question = 'Overwrite it ? (default No): ';
        $question = new ConfirmationQuestion($question, false);
        if ($this->helper->ask($this->input, $this->output, $question))
        {
          $code = $this->generateSP($tableName, $spType, $spName);
          $this->writeTwoPhases($fileName, $code);
        }
      }
      else
      {
        $code = $this->generateSP($tableName, $spType, $spName);
        $this->writeTwoPhases($fileName, $code);
      }
    }
  }
private function askForCreateSP(string $spType, string $tableName): void
  {
    $question = sprintf('Create SP for <dbo>%s</dbo> ? (default Yes): ', $spType);
    $question = new ConfirmationQuestion($question, true);
    if ($this->helper->ask($this->input, $this->output, $question))
    {
      $defaultSpName = strtolower(sprintf('%s_%s', $tableName, $spType));
      $fileName      = sprintf('%s/%s.psql', $this->sourceDirectory, $defaultSpName);

      $question = new Question(sprintf('Please enter filename (%s): ', $fileName), $fileName);
      $spName   = $this->helper->ask($this->input, $this->output, $question);

      if ($spName!==$fileName)
      {
        $spName   = strtolower($spName);
        $fileName = sprintf('%s/%s.psql', $this->sourceDirectory, $spName);
      }
      else
      {
        $spName = $defaultSpName;
      }

      if (file_exists($fileName))
      {
        $this->io->writeln(sprintf('File <fso>%s</fso> already exists', $fileName));
        $question = 'Overwrite it ? (default No): ';
        $question = new ConfirmationQuestion($question, false);
        if ($this->helper->ask($this->input, $this->output, $question))
        {
          $code = $this->generateSP($tableName, $spType, $spName);
          $this->writeTwoPhases($fileName, $code);
        }
      }
      else
      {
        $code = $this->generateSP($tableName, $spType, $spName);
        $this->writeTwoPhases($fileName, $code);
      }
    }
  }
private function askForCreateSP ( string $ spType , string $ tableName ) : void { $ question = sprintf ( 'Create SP for <dbo>%s</dbo> ? (default Yes): ' , $ spType ) ; $ question = new ConfirmationQuestion ( $ question , true ) ; if ( $ this -> helper -> ask ( $ this -> input , $ this -> output , $ question ) ) { $ defaultSpName = strtolower ( sprintf ( '%s_%s' , $ tableName , $ spType ) ) ; $ fileName = sprintf ( '%s/%s.psql' , $ this -> sourceDirectory , $ defaultSpName ) ; $ question = new Question ( sprintf ( 'Please enter filename (%s): ' , $ fileName ) , $ fileName ) ; $ spName = $ this -> helper -> ask ( $ this -> input , $ this -> output , $ question ) ; if ( $ spName !== $ fileName ) { $ spName = strtolower ( $ spName ) ; $ fileName = sprintf ( '%s/%s.psql' , $ this -> sourceDirectory , $ spName ) ; } else { $ spName = $ defaultSpName ; } if ( file_exists ( $ fileName ) ) { $ this -> io -> writeln ( sprintf ( 'File <fso>%s</fso> already exists' , $ fileName ) ) ; $ question = 'Overwrite it ? (default No): ' ; $ question = new ConfirmationQuestion ( $ question , false ) ; if ( $ this -> helper -> ask ( $ this -> input , $ this -> output , $ question ) ) { $ code = $ this -> generateSP ( $ tableName , $ spType , $ spName ) ; $ this -> writeTwoPhases ( $ fileName , $ code ) ; } } else { $ code = $ this -> generateSP ( $ tableName , $ spType , $ spName ) ; $ this -> writeTwoPhases ( $ fileName , $ code ) ; } } }
Asking function for create or not stored procedure.

@param string $spType    Stored procedure type {insert|update|delete|select}.
@param string $tableName The table name.
Asking function for create or not stored procedure .