/** * @return Deposit[]|ArrayCollection */ protected function getDeposits($uuids = array()) { $repo = $this->em->getRepository('AppBundle:Deposit'); $deposits = array(); if (count($uuids) > 0) { $deposits = $repo->findBy(array('depositUuid' => $uuids)); } else { $deposits = $repo->findAll(); } return $deposits; }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { /** @var DepositRepository $repo */ $repo = $this->em->getRepository('AppBundle:Deposit'); $summary = $repo->stateSummary(); $count = 0; foreach ($summary as $row) { $output->writeln(sprintf('%6d - %s', $row['ct'], $row['state'])); $count += $row['ct']; } $output->writeln(sprintf('%6d - total', $count)); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { /** @var DepositRepository $repo */ $repo = $this->em->getRepository('AppBundle:Deposit'); $deposits = $repo->findAll(); foreach ($deposits as $deposit) { $this->logger->notice("{$deposit->getDepositUuid()}"); $checksum = strtoupper($this->getChecksum($deposit)); if ($checksum !== $deposit->getChecksumValue()) { $this->logger->warning("Updating checksum for {$deposit->getDepositUuid()}"); $deposit->setChecksumValue($checksum); } } if (!$input->getOption('dry-run')) { $this->em->flush(); } }