示例#1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $em = $this->getContainer()->get('doctrine')->getManager();
     $parser = $this->getContainer()->get('lke_core.parse_csv');
     $rows = $parser->parse(self::FILE);
     foreach ($rows as $row) {
         $remark = new Remark();
         $remark->setSentence(substr($row[self::SENTENCE], 0, 140));
         $remark->setContext($row[self::CONTEXTE]);
         $remark->setPostedAt($this->getDateTime($row[self::POSTEDAT]));
         $remark->setScaleEmotion($row[self::SCALE_EMOTION]);
         $remark->setEmail($this->getEmail($row[self::EMAIL]));
         $remark->setTheme($this->getTheme($row[self::THEME_ID]));
         $remark->setEmotion($this->getEmotion($row[self::EMOTION_ID]));
         $em->persist($remark);
     }
     $em->flush();
     $output->writeln("Remarks loaded");
 }
示例#2
0
 /**
  * @JMS\VirtualProperty()
  */
 public function getRemarkId()
 {
     return $this->remark->getId();
 }