/** * Main function for asking. * * @param array[] $tableList All existing tables from data schema. */ private function startAsking($tableList) { $question = new Question('Please enter <note>TABLE NAME</note>: '); $tableName = $this->helper->ask($this->input, $this->output, $question); $key = StaticDataLayer::searchInRowSet('table_name', $tableName, $tableList); if (!isset($key)) { $this->io->logNote('Table \'%s\' not exist.', $tableName); } else { $this->askForCreateSP('INSERT', $tableName); $this->askForCreateSP('UPDATE', $tableName); $this->askForCreateSP('DELETE', $tableName); $this->askForCreateSP('SELECT', $tableName); } }
/** * Validates the parameters found the DocBlock in the source of the stored routine against the parameters from the * metadata of MySQL and reports missing and unknown parameters names. */ private function validateParameterLists() { // Make list with names of parameters used in database. $database_parameters_names = []; foreach ($this->parameters as $parameter_info) { $database_parameters_names[] = $parameter_info['parameter_name']; } // Make list with names of parameters used in dock block of routine. $doc_block_parameters_names = []; if (isset($this->docBlockPartsSource['parameters'])) { foreach ($this->docBlockPartsSource['parameters'] as $parameter) { $doc_block_parameters_names[] = $parameter['name']; } } // Check and show warning if any parameters is missing in doc block. $tmp = array_diff($database_parameters_names, $doc_block_parameters_names); foreach ($tmp as $name) { $this->io->logNote('Parameter <dbo>%s</dbo> is missing from doc block', $name); } // Check and show warning if find unknown parameters in doc block. $tmp = array_diff($doc_block_parameters_names, $database_parameters_names); foreach ($tmp as $name) { $this->io->logNote('Unknown parameter <dbo>%s</dbo> found in doc block', $name); } }