interact() protected method

See also: Command
protected interact ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
Esempio n. 1
0
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     parent::interact($input, $output);
     if (!$input->getArgument('firstname')) {
         $firstname = $this->getHelper('dialog')->askAndValidate($output, 'Please choose a firstname:', function ($firstname) {
             if (empty($firstname)) {
                 throw new \Exception('Firstname can not be empty');
             }
             return $firstname;
         });
         $input->setArgument('firstname', $firstname);
     }
     if (!$input->getArgument('lastname')) {
         $lastname = $this->getHelper('dialog')->askAndValidate($output, 'Please choose a lastname:', function ($lastname) {
             if (empty($lastname)) {
                 throw new \Exception('Lastname can not be empty');
             }
             return $lastname;
         });
         $input->setArgument('lastname', $lastname);
     }
     if (!$input->getArgument('enterprise')) {
         $enterprise = $this->getHelper('dialog')->askAndValidate($output, 'Please choose an enterprise:', function ($enterprise) {
             if (empty($enterprise)) {
                 throw new \Exception('Enterprise can not be empty');
             }
             return $enterprise;
         });
         $input->setArgument('enterprise', $enterprise);
     }
 }
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     /** @var UserDiscriminatorInterface $discriminator */
     $discriminator = $this->getContainer()->get('rollerworks_multi_user.user_discriminator');
     $discriminator->setCurrentUser($input->getOption('user-system'));
     parent::interact($input, $output);
 }
 /**
  * @see Command
  */
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     //list available databases without prefix
     $dbs_list = 'Available databases:' . "\n";
     $dbs_array = $this->database_list();
     foreach ($dbs_array as $db) {
         $dbs_list .= '- ' . $db . "\n";
     }
     parent::interact($input, $output);
     //display help
     if (!$input->getArgument('dbName')) {
         $dbName = $this->getHelper('dialog')->askAndValidate($output, $dbs_list . 'Please choose a database name in the list (otherwise, new database will be created):', function ($dbName) {
             if (empty($dbName)) {
                 throw new \Exception('Database name can not be empty');
             }
             return $dbName;
         });
         $input->setArgument('dbName', $dbName);
     }
 }
Esempio n. 4
0
 /**
  * @see Command
  */
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     parent::interact($input, $output);
     if (!$input->getArgument('nom')) {
         $nom = $this->getHelper('dialog')->askAndValidate($output, 'Please choose a lastname:', function ($nom) {
             if (empty($nom)) {
                 throw new \Exception('Lastname can not be empty');
             }
             return $nom;
         });
         $input->setArgument('nom', $nom);
     }
     if (!$input->getArgument('prenom')) {
         $prenom = $this->getHelper('dialog')->askAndValidate($output, 'Please choose a firstname:', function ($prenom) {
             if (empty($prenom)) {
                 throw new \Exception('firstname can not be empty');
             }
             return $prenom;
         });
         $input->setArgument('prenom', $prenom);
     }
 }
Esempio n. 5
0
 /**
  * @see Command
  */
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     parent::interact($input, $output);
     if (!$input->getArgument('nom')) {
         $firstname = $this->getHelper('dialog')->askAndValidate($output, 'Please choose a firstname:', function ($firstname) {
             if (empty($firstname)) {
                 throw new \Exception('Firstname can not be empty');
             }
             return $firstname;
         });
         $input->setArgument('nom', $firstname);
     }
     if (!$input->getArgument('prenoms')) {
         $lastname = $this->getHelper('dialog')->askAndValidate($output, 'Please choose a lastname:', function ($lastname) {
             if (empty($lastname)) {
                 throw new \Exception('Lastname can not be empty');
             }
             return $lastname;
         });
         $input->setArgument('prenoms', $lastname);
     }
     if (!$input->getArgument('dateNaissance')) {
         $birthday = $this->getHelper('dialog')->askAndValidate($output, 'Please choose a birthday:', function ($birthday) {
             if (empty($birthday)) {
                 throw new \Exception('birthday can not be empty');
             }
             return $birthday;
         });
         $input->setArgument('dateNaissance', $birthday);
     }
     if (!$input->getArgument('sexe')) {
         $gender = $this->getHelper('dialog')->askAndValidate($output, 'Please choose a gender (M=1) (F=2) :', function ($gender) {
             if (empty($gender)) {
                 throw new \Exception('gender can not be empty');
             }
             return $gender;
         });
         $input->setArgument('sexe', $gender);
     }
     if (!$input->getArgument('adresse')) {
         $address = $this->getHelper('dialog')->askAndValidate($output, 'Please choose an address :', function ($address) {
             if (empty($address)) {
                 throw new \Exception('address can not be empty');
             }
             return $address;
         });
         $input->setArgument('adresse', $address);
     }
     if (!$input->getArgument('telephone')) {
         $telephone = $this->getHelper('dialog')->askAndValidate($output, 'Please choose a telephone number :', function ($telephone) {
             return $telephone;
         });
         $input->setArgument('telephone', $telephone);
     }
     if (!$input->getArgument('image')) {
         $image = $this->getHelper('dialog')->askAndValidate($output, 'Please choose a picture :', function ($image) {
             return $image;
         });
         $input->setArgument('image', $image);
     }
 }