em = $em; parent::__construct(); } protected function configure() { $this->setName('cmbcustomer:updatecustomer') ->setDescription('Set customer last name.') ->setHelp('Set the customer last name. '); } protected function execute(InputInterface $input, OutputInterface $output) { error_log('Updating customer last name...'); // get all customers $cust_results = $this->em->getRepository(Customer::class)->findBy(['last_name' => '']); foreach ($cust_results as $cust) { $cust->setLastName(self::STR_LAST_NAME); } $this->em->flush(); $this->em->clear(); return 0; } }