我正在寻找一些帮助Gedmo Translatable和Symfony 3.我使用yml文件来声明我的实体,它的工作原理,但是,当我尝试使用gedmo translatable,它doesn'产生任何翻译表...Gedmo Translatable不能在Symfony 3上工作
我config.yml:
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
filters:
softdeleteable:
class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
enabled: true
#translatable
mappings:
translatable:
type: annotation
alias: Gedmo
prefix: Gedmo\Translatable\Entity
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity/MappedSuperclass"
我不知道是否该类型值是 “annoation” 在我的情况。我尝试过“yml”,但没有奏效。
分类实体:
<?php
namespace Project\MyBundle\Entity;
use Doctrine\ORM\Query\AST\InExpression;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Translatable\Translatable;
/**
* Category
*/
class Category extends \Project\MyBundle\Entity\Item implements \Project\MyBundle\Model\CategoryInterface, Translatable
{
/**
* @Gedmo\Translatable
* @var string
*/
private $label;
/**
* @Gedmo\Translatable
* @var string
*/
private $description;
}
category.orm.yml:
Project\MyBundle\Entity\Category:
type: entity
table: category
repositoryClass: Project\MyBundle\Repository\CategoryRepository
gedmo:
translation:
entity: Project\MyBundle\Entity\Translation\CategoryTranslation
fields:
label:
type: string
length: 255
gedmo:
- translatable
description:
type: string
length: 255
gedmo:
- translatable
而且我CategoryTranslation.php:
<?php
namespace Project\MyBundle\Entity\Translation;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractTranslation;
/**
* @ORM\Table(name="category_translation", indexes={
* @ORM\Index(name="category_translation_idx", columns={"locale", "object_class", "field", "foreign_key"})
* })
* @ORM\Entity(repositoryClass="Gedmo\Translatable\Entity\Repository\TranslationRepository")
*/
class CategoryTranslation extends AbstractTranslation
{
/**
* All required columns are mapped through inherited superclass
*/
}
当我运行 “的信条:映射:info” 命令:
Found XX mapped entities:
[OK] Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation
[OK] Gedmo\Translatable\Entity\MappedSuperclass\AbstractTranslation
....
[OK] Project\MyBundle\Entity\Category
...
类别是确定的,但不能看到CategoryTranslation ...
你有这个问题的想法?
非常感谢!