ImportManufacturersCommand.php (889B)
1 <?php 2 3 namespace PartKeepr\SetupBundle\Command; 4 5 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; 6 use Symfony\Component\Console\Input\InputInterface; 7 use Symfony\Component\Console\Output\OutputInterface; 8 9 class ImportManufacturersCommand extends ContainerAwareCommand 10 { 11 public function configure() 12 { 13 parent::configure(); 14 $this->setName('partkeepr:setup:import-manufacturers'); 15 $this->setDescription('Imports the default PartKeepr manufacturers'); 16 } 17 18 public function execute(InputInterface $input, OutputInterface $output) 19 { 20 $return = $this->getContainer()->get('partkeepr.setup.manufacturer_service')->importManufacturers(); 21 22 $output->writeln(sprintf( 23 '%d manufacturers imported, %d existing manufacturers skipped', 24 $return['imported'], 25 $return['skipped'] 26 )); 27 } 28 }