protected function execute(InputInterface $input, OutputInterface $output)
 {
     $title = $input->getArgument('title');
     $date = $input->getArgument('date');
     $amount = 0 - $input->getArgument('amount');
     $months = $input->getArgument('months');
     $em = $this->getContainer()->get('doctrine.orm.entity_manager');
     $date = new \DateTime($date);
     $site = $em->getRepository('AppBundle:FinanceSite')->findOneByTitle('京东白条');
     $start = clone $date;
     $end = $date->add(new \DateInterval('P1M'));
     foreach (range(1, $months) as $i) {
         $finance = new Finance();
         $finance->setTitle($title . '第' . $i . '期');
         $finance->setAmount($amount);
         $finance->setTotal($amount);
         $finance->setSite($site);
         $finance->setType(Finance::TYPE_LOAN);
         $finance->setBoughtAt($start);
         $finance->setStartedAt($start);
         $finance->setFinishedAt(clone $end);
         $finance->setReturnedAt(clone $end);
         $em->persist($finance);
         $end->add(new \DateInterval('P1M'));
     }
     $em->flush();
     $output->writeln('done');
 }