1
我有使用DococineExtensions的Translatable字段的实体。这是它的外观:使用DoctrineExtensions翻译的克隆Doctrine实体可翻译
/**
* @ORM\Table
* @ORM\Entity(repositoryClass="AppBundle\Entity\Repository\SurveyAnswerRepository")
* @Gedmo\Loggable
*/
class SurveyAnswer
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(type="string", length=200)
* @Gedmo\Versioned
* @Gedmo\Translatable
*/
private $name;
/**
* @Gedmo\Locale
* Used locale to override Translation listener`s locale
* this is not a mapped field of entity metadata, just a simple property
* and it is not necessary because globally locale can be set in listener
*/
private $locale;
public function __clone()
{
if ($this->getId())
{
$this->id = null;
}
}
public function setTranslatableLocale($locale)
{
$this->locale = $locale;
}
public function getId()
{
return $this->id;
}
public function setName($name)
{
$this->name = $name;
return $this;
}
public function getName()
{
return $this->name;
}
}
当我克隆这样的实体,新建一个只包括翻译在当前区域的Symfony应用程序设置。所有其他语言的翻译缺失。
如何存储在翻译?你有访问他们吗? –
在单独的表中,但我想避免手动复制(我的意思是写一些额外的代码来发现和完成缺失的翻译),如果可能的话:) – Marek