示例#1
0
 /**
  * save word
  *
  * @param Word $word
  * @param string $name
  * @param array $results
  */
 public function saveWord($word, $name, $results)
 {
     $em = $this->getEntityManager();
     $word->check("synonym");
     foreach ($results as $synonymName) {
         $synonym = $this->getWord($synonymName);
         $word->addSynonym($synonym);
         $em->persist($synonym);
         $em->flush();
         unset($synonym);
     }
     $em->persist($word);
     $em->flush();
 }