private function askForArguments(InputInterface $input, OutputInterface $output)
{
$helper = $this->getHelper('question');
$argument = array();
// Attribute ID
if (is_null($input->getArgument('attribute-id'))) {
$attribute_code = Mage::getModel('eav/entity_attribute')->getCollection()->addFieldToSelect('*')->addFieldToFilter('entity_type_id', array('eq' => 4))->addFieldToFilter('backend_type', array('in' => array('int')))->setOrder('attribute_id', 'ASC');
$attribute_codes = array();
foreach ($attribute_code as $item) {
$attribute_codes[$item['attribute_id']] = $item['attribute_id'] . "|" . $item['attribute_code'];
}
$question = new ChoiceQuestion('Please select Attribute ID', $attribute_codes);
$question->setErrorMessage('Attribute ID "%s" is invalid.');
$response = explode("|", $helper->ask($input, $output, $question));
$input->setArgument('attribute-id', $response[0]);
}
$output->writeln('<info>Attribute code selected: ' . $input->getArgument('attribute-id') . "</info>");
$argument['attribute-id'] = (int) $input->getArgument('attribute-id');
// Type of Values
if (is_null($input->getArgument('values-type'))) {
$valueTypes = DummyValues::getValueTypeList();
$question = new ChoiceQuestion('Please select Attribute Value Type', $valueTypes, 'int');
$question->setErrorMessage('Attribute Value Type "%s" is invalid.');
$input->setArgument('values-type', $helper->ask($input, $output, $question));
}
$output->writeln('<info>Attribute Value Type selected: ' . $input->getArgument('values-type') . "</info>");
$argument['values-type'] = $input->getArgument('values-type');
// Number of Values
if (is_null($input->getArgument('values-number'))) {
$question = new Question("Please enter the number of values to create (default 1): ", 1);
$question->setValidator(function ($answer) {
$answer = (int) $answer;
if (!is_int($answer) || $answer <= 0) {
throw new \RuntimeException('Please enter an integer value or > 0');
}
return $answer;
});
$input->setArgument('values-number', $helper->ask($input, $output, $question));
}
$output->writeln('<info>Number of values to create: ' . $input->getArgument('values-number') . "</info>");
$argument['values-number'] = $input->getArgument('values-number');
return $argument;
}