IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Symfony PHP Discussion :

Intégration bundle A2LiX pour site multilingue [2.x]


Sujet :

Symfony PHP

  1. #1
    Membre du Club
    Homme Profil pro
    Responsable de service informatique
    Inscrit en
    Août 2004
    Messages
    39
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Responsable de service informatique
    Secteur : Distribution

    Informations forums :
    Inscription : Août 2004
    Messages : 39
    Points : 42
    Points
    42
    Par défaut Intégration bundle A2LiX pour site multilingue
    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
    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';
        }
    }
    Dès que je décommente "$builder->add('translations', 'a2lix_translations');", j'obtiens le message:
    Neither the property "translations" nor one of the methods "getTranslations()", "isTranslations()", "hasTranslations()", "__get()" exist and have public access in class "RevivalSoftware\LeonardoBundle\Entity\Dictionary".
    Pourtant, il me semble avoir suivi les indications fournies sur le site.

    Mon entité Dictionary:
    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;
        }
     
    }
    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
    <?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;
        }
     
    }
    Le fichier "ObjectTranslation.php" a été ajouté dans le dossier "Entity" de mon bundle et les fichiers config ont été modifiés également.

    Quelqu'un utilise-t-il ces bundles ? Une aide sur le sujet serait grandement appréciée

    Merci d'avance

    Cordialement,
    Arnaud LEF97

  2. #2
    Membre du Club
    Homme Profil pro
    Responsable de service informatique
    Inscrit en
    Août 2004
    Messages
    39
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Responsable de service informatique
    Secteur : Distribution

    Informations forums :
    Inscription : Août 2004
    Messages : 39
    Points : 42
    Points
    42
    Par défaut Yes !
    Enfin, j'ai réussi à me dépatouiller.
    J'avais plusieurs anomalies dans mon code.
    Si cela peut aider, voici les nouvelles entités avec la config qui fonctionne:

    Dictionary
    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
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    <?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
    {
        use \A2lix\I18nDoctrineBundle\Doctrine\ORM\Util\Translatable;
     
        /**
         * @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;
     
     
        // Début intégration translation
        protected $translations;    
        public function __contruct()
        {
            $this->translations = new \Doctrine\Common\Collections\ArrayCollection();
        }    
        // Fin intégration translation
     
        /**
         * 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;
        }
    }
    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
    <?php
     
    namespace RevivalSoftware\LeonardoBundle\Entity;
     
    use Doctrine\ORM\Mapping as ORM;
     
    /**
     * @ORM\Entity
     */
    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 setDataValue($dataValue)
        {
            $this->dataValue = $dataValue;
     
            return $this;
        }
     
        public function getDataValue()
        {
            return $this->dataValue;
        }   
     
    }
    Cordialement,
    Arnaud

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. GWT et sitemaps pour site multilingue
    Par redah75 dans le forum Référencement
    Réponses: 2
    Dernier message: 13/03/2014, 20h37
  2. Google Sitemap pour site multilingues
    Par redah75 dans le forum Référencement
    Réponses: 0
    Dernier message: 03/06/2012, 22h15
  3. Réécriture url pour site multilingue
    Par redah75 dans le forum Apache
    Réponses: 29
    Dernier message: 22/12/2009, 16h54
  4. Aide pour Site Multilingue
    Par Ikonic dans le forum Flash
    Réponses: 2
    Dernier message: 11/04/2007, 11h23
  5. [XML] XML pour site multilingue
    Par zorian dans le forum Bibliothèques et frameworks
    Réponses: 7
    Dernier message: 07/06/2006, 21h19

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo