Bonjour,
Je galère un peu à intégrer les bundle d'A2LiX pour mon site multilingue.
J'ai installé i18n-doctrine puis Translation-Form.
Pour le premier, il me semble que cela fonctionne car ma BDD semble correctement structurée (mais je ne pourrai en être sur qu'avec l'utilisation du second).
Pour le second, dès que j'active l'affichage de la partie traduction du formulaire, j'obtiens un message d'erreur.
Le code du formulaire
Dès que je décommente "$builder->add('translations', 'a2lix_translations');", j'obtiens le message:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 <?php namespace RevivalSoftware\LeonardoBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; class DictionaryType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('DataName', 'text', array('label' => 'Nom test')); // $builder->add('translations', 'a2lix_translations'); $builder->add('save', 'submit', array('label' => 'Submit')); } public function getName() { return 'dictionary'; } }
Pourtant, il me semble avoir suivi les indications fournies sur le site.Neither the property "translations" nor one of the methods "getTranslations()", "isTranslations()", "hasTranslations()", "__get()" exist and have public access in class "RevivalSoftware\LeonardoBundle\Entity\Dictionary".
Mon entité Dictionary:
Mon entité DictionaryTranslation
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 <?php namespace RevivalSoftware\LeonardoBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Dictionary * * @ORM\Table(name="dictionary") * @ORM\Entity(repositoryClass="RevivalSoftware\LeonardoBundle\Entity\DictionaryRepository") */ class Dictionary { /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string * * @ORM\Column(name="DataName", type="string", length=255) */ private $dataName; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set dataName * * @param string $dataName * @return Dictionary */ public function setDataName($dataName) { $this->dataName = $dataName; return $this; } /** * Get dataName * * @return string */ public function getDataName() { return $this->dataName; } }
Le fichier "ObjectTranslation.php" a été ajouté dans le dossier "Entity" de mon bundle et les fichiers config ont été modifiés également.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 <?php namespace RevivalSoftware\LeonardoBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Dictionary * * @ORM\Table() */ class DictionaryTranslation implements \A2lix\I18nDoctrineBundle\Doctrine\Interfaces\OneLocaleInterface { use \A2lix\I18nDoctrineBundle\Doctrine\ORM\Util\Translation; /** * @var string * * @ORM\Column(name="DataValue", type="string", length=255) */ private $dataValue; public function getId() { return $this->id; } public function setDataValue($dataValue) { $this->dataValue = $dataValue; return $this; } public function getDataValue() { return $this->dataValue; } }
Quelqu'un utilise-t-il ces bundles ? Une aide sur le sujet serait grandement appréciée
Merci d'avance
Cordialement,
Arnaud LEF97
Partager