i try setup translations form
http://a2lix.fr/bundles/translation-form/ and https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/translatable.md#translatable-entity-example
composer.json
"a2lix/translation-form-bundle": "2.*@dev",
"stof/doctrine-extensions-bundle": "1.2.*@dev",
config.yml
stof_doctrine_extensions: default_locale: en orm: default: translatable: true sluggable: true sluggable: true timestampable: true
a2lix_translation_form:
locale_provider: default # [1]
locales: [pl, en, de] # [1-a]
default_locale: en
manager_registry: doctrine # [2]
templating: "A2lixTranslationFormBundle::default.html.twig"
entity
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use APY\DataGridBundle\Grid\Mapping as GRID;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Translatable\Translatable;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="c_Base"
,indexes={
* @ORM\Index(name="search_name", columns={"name"}),
* @ORM\Index(name="orderCity", columns={"city"})
* })
*/
class Base implements Translatable{
/**
* @ORM\Column(type="bigint")
* @ORM\Id
*/
private $id;
/**
* Hexaid
* @var string
*/
private $hid;
/**
* @ORM\Column(type="string")
* @GRID\Column(title="name")
* @Gedmo\Translatable
* @var string
*/
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
*/
private $locale;
build form
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder
->add('translations', 'a2lix_translations', array(
'fields'=>array(
'name'=>array(),
'description'=>array(
'field_type' => 'ckeditor'
)
)
)
);
error
Neither the property "translations" nor one of the methods "getTranslations()", "translations()", "isTranslations()", "hasTranslations()", "__get()" exist and have public access in class "Mea\CharterBundle\Entity\Base".
i dont't have private $translations; var in base - because is public translation - in example for personal translations exist $translations https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/translatable.md#personal-translations
but for https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/translatable.md#translatable-entity-example not.
Can i use it in http://a2lix.fr/bundles/translation-form/ ?
here is other way example DoctrineExtensions Notice: Undefined index: foreignKey in $em->getRepository('Gedmo\\Translatable\\Entity\\Translation');