Symfony-Gedmo可翻译找不到表

时间:2019-04-23 13:04:52

标签: php translation query-builder symfony-3.4

看来,除了我要在表中转储()转换表中数据的位置之外,其他所有功能都正常运行。数据在那里,现在我需要返回翻译后的结果,但是会抛出:

  

在执行\ u0027SELECT e0_.content AS content_0,e0_.field AS field_1,e0_.locale AS locale_2 FROM ext_translations e0_ WHERE e0_.foreign_key =吗? AND e0_.object_class =?带有参数[1,\ AppBundle \\ Entity \\ About \\ Terms \ u0022]的ORDER BY e0_.locale ASC \ u0027:\ n \ nSQLSTATE [42S02]:找不到基本表或视图:1146表\ u0027app.ext_translations \ u0027不存在”

我检查了config.yml文件,它可以正常工作。

这是我的功能:

$article = $this->getTermsRepository()->find(1);
    $article->setTranslatableLocale('ru_ru');
    $this->em->refresh($article);

    $article = $this->getTermsRepository()->find(1);
    $repository = $this->em->getRepository('Gedmo\Translatable\Entity\Translation');
    $translations = $repository->findTranslations($article);

    dump($translations);die;

还有我的实体

class Terms implements Translatable
 {

/**
 * @ORM\Id
 * @ORM\Column(type="integer")
 * @ORM\GeneratedValue(strategy="AUTO")
 * @Groups({"basic_data", "terms_data", "basic_legal_data"})
 */
protected $id;

/**
 * @ORM\Column(name="text", type="text", length=65536)
 * @Groups({"basic_data", "terms_data"})
 */
private $text;

/**
 * @Gedmo\Locale
 * Used locale to override Translation listener`s locale
 * this is not a mapped field of entity metadata, just a simple property
 */
private $locale;



 // --- all getters and setters



public function setTranslatableLocale($locale)
{
    $this->locale = $locale;
}

0 个答案:

没有答案