sf 2.6 A2LiX entityTranslation 找不到
sf 2.6 A2LiX entityTranslation doesn't found
我只是想制作一个多语言应用程序站点,所以我看到了可翻译和其他捆绑包。
我使用 translatable 和 a2lix...所以我阅读了文档,但是当我尝试使用 a2lix 时,我收到此错误消息:
Class c2c\AppBundle\Entity\PeriodTranslation does not exist 500 Internal Server Error - ReflectionException
我将我的 entityTranslation 设置在这样的子文件夹中 Entity>Translation>MyEntityTranslation
有没有办法告诉 a2lix... 它应该在我的子文件夹中查找?
感谢您的帮助。
实体
namespace c2c\AppBundle\Entity;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Translatable\Translatable;
/**
* Period
*
* @ORM\Table(name="Periods")
* @ORM\Entity(repositoryClass="c2c\AppBundle\Entity\PeriodRepository")
* @Gedmo\TranslationEntity(class="c2c\AppBundle\Entity\Translation\PeriodTranslation")
*/
class Period implements Translatable
...
实体翻译
namespace c2c\AppBundle\Entity\Translation;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractTranslation;
/**
* PeriodTranslation is used fo
*
* @author blucas
*/
/**
* @ORM\Table(name="ext_translations_period", indexes={
* @ORM\Index(name="period_translation_idx", columns={"locale", "object_class", "field", "foreign_key"})
* })
* @ORM\Entity(repositoryClass="Gedmo\Translatable\Entity\Repository\TranslationRepository")
*/
class PeriodTranslation extends AbstractTranslation
{
/**
* All required columns are mapped through inherited superclass
*/
}
配置
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
mappings:
gedmo_translatable:
type: annotation
prefix: Gedmo\Translatable\Entity
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity"
alias: GedmoTranslatable
is_bundle: false
...
# Soft Doctrine extendions
stof_doctrine_extensions:
default_locale: en_US
# Only used if you activated the Uploadable extension
# uploadable:
# Default file path: This is one of the three ways you can configure the path for the Uploadable extension
# default_file_path: %kernel.root_dir%/../web/uploads
# Mime type guesser class: Optional. By default, we provide an adapter for the one present in the HttpFoundation component of Symfony
# mime_type_guesser_class: Stof\DoctrineExtensionsBundle\Uploadable\MimeTypeGuesserAdapter
# Default file info class implementing FileInfoInterface: Optional. By default we provide a class which is prepared to receive an UploadedFile instance.
# default_file_info_class: Stof\DoctrineExtensionsBundle\Uploadable\UploadedFileInfo
orm:
default:
# sluggable: true
translatable: true
...
# Give a way to translate form
a2lix_translation_form:
locale_provider: default
locales: [en,fr,nl]
default_locale: en
required_locales: [en]
manager_registry: doctrine
templating: "A2lixTranslationFormBundle::default.html.twig"
由于最新版本的a2lix
与Gedmo
的稳定版本不兼容而抛出错误
检查这个答案
如果您想使用 Gedmo 策略,则必须将 "a2lix/translation-form-bundle"
降级为 "1.*@dev"
如果您想使用最新版本的 "a2lix/translation-form-bundle"
,则必须使用
wip2.4 Gedmo
版本,还不稳定
检查这个https://github.com/a2lix/TranslationFormBundle/blob/master/UPGRADE-2.0.md
我只是想制作一个多语言应用程序站点,所以我看到了可翻译和其他捆绑包。
我使用 translatable 和 a2lix...所以我阅读了文档,但是当我尝试使用 a2lix 时,我收到此错误消息:
Class c2c\AppBundle\Entity\PeriodTranslation does not exist 500 Internal Server Error - ReflectionException
我将我的 entityTranslation 设置在这样的子文件夹中 Entity>Translation>MyEntityTranslation
有没有办法告诉 a2lix... 它应该在我的子文件夹中查找?
感谢您的帮助。
实体
namespace c2c\AppBundle\Entity;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Translatable\Translatable;
/**
* Period
*
* @ORM\Table(name="Periods")
* @ORM\Entity(repositoryClass="c2c\AppBundle\Entity\PeriodRepository")
* @Gedmo\TranslationEntity(class="c2c\AppBundle\Entity\Translation\PeriodTranslation")
*/
class Period implements Translatable
...
实体翻译
namespace c2c\AppBundle\Entity\Translation;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractTranslation;
/**
* PeriodTranslation is used fo
*
* @author blucas
*/
/**
* @ORM\Table(name="ext_translations_period", indexes={
* @ORM\Index(name="period_translation_idx", columns={"locale", "object_class", "field", "foreign_key"})
* })
* @ORM\Entity(repositoryClass="Gedmo\Translatable\Entity\Repository\TranslationRepository")
*/
class PeriodTranslation extends AbstractTranslation
{
/**
* All required columns are mapped through inherited superclass
*/
}
配置
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
mappings:
gedmo_translatable:
type: annotation
prefix: Gedmo\Translatable\Entity
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity"
alias: GedmoTranslatable
is_bundle: false
...
# Soft Doctrine extendions
stof_doctrine_extensions:
default_locale: en_US
# Only used if you activated the Uploadable extension
# uploadable:
# Default file path: This is one of the three ways you can configure the path for the Uploadable extension
# default_file_path: %kernel.root_dir%/../web/uploads
# Mime type guesser class: Optional. By default, we provide an adapter for the one present in the HttpFoundation component of Symfony
# mime_type_guesser_class: Stof\DoctrineExtensionsBundle\Uploadable\MimeTypeGuesserAdapter
# Default file info class implementing FileInfoInterface: Optional. By default we provide a class which is prepared to receive an UploadedFile instance.
# default_file_info_class: Stof\DoctrineExtensionsBundle\Uploadable\UploadedFileInfo
orm:
default:
# sluggable: true
translatable: true
...
# Give a way to translate form
a2lix_translation_form:
locale_provider: default
locales: [en,fr,nl]
default_locale: en
required_locales: [en]
manager_registry: doctrine
templating: "A2lixTranslationFormBundle::default.html.twig"
由于最新版本的a2lix
与Gedmo
检查这个答案
如果您想使用 Gedmo 策略,则必须将 "a2lix/translation-form-bundle"
降级为 "1.*@dev"
如果您想使用最新版本的 "a2lix/translation-form-bundle"
,则必须使用
wip2.4 Gedmo
版本,还不稳定
检查这个https://github.com/a2lix/TranslationFormBundle/blob/master/UPGRADE-2.0.md