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

Doctrine2 PHP Discussion :

problème d'héritage


Sujet :

Doctrine2 PHP

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Novembre 2008
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2008
    Messages : 8
    Par défaut problème d'héritage
    Bonjour,

    Je suis entrain de développer un projet en Symfony2 utilisant l'ORM Doctrine2. Je rencontre des problèmes au niveau du mapping, notamment l'héritage.
    Lorsque je lance la commande
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     app/console doctrine:mapping:info
    Elle retourne OK et je peux travailler avec les objets, l'héritage se fait correctement.
    Alors que quand je lance la commande
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    app/console doctrine:schema:update --force
    là j'ai l'erreur suivante :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Warning: class_parents(): Class DOS\EntrepriseBundle\Entity\Candidat does not exist and could not be loaded in /home/sfprojects/sebinize/vendor/doctrine/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php line 223
    Mes classes sont les suivantes :
    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
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
     
     
    namespace DOS\CandidatBundle\Entity;
     
    use Doctrine\ORM\Mapping as ORM;
     
    /**
     * DOS\CandidatBundle\Entity\Personne
    *
    * @ORM\Table()
    * @ORM\Entity
    * @ORM\InheritanceType("SINGLE_TABLE")
    * @ORM\DiscriminatorColumn(name="type", type="string")
    * @ORM\DiscriminatorMap({"candidat" = "DOS\CandidatBundle\Entity\Candidat", "profil" = "DOS\EntrepriseBundle\Entity\Profil"})
    *
    */
     
     
    class Personne
    {
        /**
         * @var integer $id
         *
         * @ORM\Column(name="id", type="integer")
         * @ORM\Id
         * @ORM\GeneratedValue(strategy="AUTO")
         */
        private $id;
     
        /**
         * @var string $nom
         *
         * @ORM\Column(name="nom", type="string", length=30)
         */
        private $nom;
     
        /**
         * @var string $prenom
         *
         * @ORM\Column(name="prenom", type="string", length=30)
         */
        private $prenom;
     
        /**
         * @var string $telephone
         *
         * @ORM\Column(name="telephone", type="string", length=10)
         */
        private $telephone;
     
        /**
         * @var string $email
         *
         * @ORM\Column(name="email", type="string", length=60)
         */
        private $email;
     
        /**
         * @var string $commentaire
         *
         * @ORM\Column(name="commentaire", type="string", length=255)
         */
        private $commentaire;
     
     
        /**
         * Get id
         *
         * @return integer 
         */
        public function getId()
        {
            return $this->id;
        }
     
        /**
         * Set nom
         *
         * @param string $nom
         */
        public function setNom($nom)
        {
            $this->nom = $nom;
        }
     
        /**
         * Get nom
         *
         * @return string 
         */
        public function getNom()
        {
            return $this->nom;
        }
     
        /**
         * Set prenom
         *
         * @param string $prenom
         */
        public function setPrenom($prenom)
        {
            $this->prenom = $prenom;
        }
     
        /**
         * Get prenom
         *
         * @return string 
         */
        public function getPrenom()
        {
            return $this->prenom;
        }
     
        /**
         * Set telephone
         *
         * @param string $telephone
         */
        public function setTelephone($telephone)
        {
            $this->telephone = $telephone;
        }
     
        /**
         * Get telephone
         *
         * @return string 
         */
        public function getTelephone()
        {
            return $this->telephone;
        }
     
        /**
         * Set email
         *
         * @param string $email
         */
        public function setEmail($email)
        {
            $this->email = $email;
        }
     
        /**
         * Get email
         *
         * @return string 
         */
        public function getEmail()
        {
            return $this->email;
        }
     
        /**
         * Set commentaire
         *
         * @param string $commentaire
         */
        public function setCommentaire($commentaire)
        {
            $this->commentaire = $commentaire;
        }
     
        /**
         * Get commentaire
         *
         * @return string 
         */
        public function getCommentaire()
        {
            return $this->commentaire;
        }
    }

    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
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    namespace DOS\CandidatBundle\Entity;
     
     
    use Doctrine\ORM\Mapping as ORM;
    use DOS\CandidatBundle\Entity\Personne;
    use DOS\EntrepriseBundle\Entity\Entreprise;
    use Doctrine\Common\Annotations\Annotation;
    /**
     * DOS\CandidatBundle\Entity\Candidat
     *
     * @ORM\Table()
     * @ORM\Entity
     */
    class Candidat extends Personne
    {
     
        /**
         * @var string $cv
         *
         * @ORM\Column(name="cv", type="string", length=255)
         */
        private $cv;
     
        /**
         * @var string $specialite
         *
         * @ORM\Column(name="specialite", type="string", length=30)
         */
        private $specialite;
     
        /**
         * @var string $cursus
         *
         * @ORM\Column(name="cursus", type="string", length=20)
         */
        private $cursus;
     
        /**
         * @var string $etat
         *
         * @ORM\Column(name="etat", type="string", length=20)
         */
        private $etat;
     
     
        /**
         * @ORM\OneToOne(targetEntity="DOS\EntrepriseBundle\Entity\Entreprise")
         * @ORM\JoinColumn(name="entreprise_id", referencedColumnName="id")
        */
        private $entreprise;
     
     
        /**
         * @ORM\ManyToMany(targetEntity="Promotion")
         * @ORM\JoinTable(name="candidat_promotion",joinColumns={@ORM\JoinColumn(name="promotion_id", referencedColumnName="id")},
         *      inverseJoinColumns={@ORM\JoinColumn(name="candidat_id", referencedColumnName="id")}
         *      )
         */
        private $promotions;
     
         public function __construct() {
            $this->promotions = new \Doctrine\Common\Collections\ArrayCollection();
        }
     
     
        /**
         * Get id
         *
         * @return integer 
         */
        public function getId()
        {
            return $this->id;
        }
     
        /**
         * Set cv
         *
         * @param string $cv
         */
        public function setCv($cv)
        {
            $this->cv = $cv;
        }
     
        /**
         * Get cv
         *
         * @return string 
         */
        public function getCv()
        {
            return $this->cv;
        }
     
        /**
         * Set specialite
         *
         * @param string $specialite
         */
        public function setSpecialite($specialite)
        {
            $this->specialite = $specialite;
        }
     
        /**
         * Get specialite
         *
         * @return string 
         */
        public function getSpecialite()
        {
            return $this->specialite;
        }
     
        /**
         * Set cursus
         *
         * @param string $cursus
         */
        public function setCursus($cursus)
        {
            $this->cursus = $cursus;
        }
     
        /**
         * Get cursus
         *
         * @return string 
         */
        public function getCursus()
        {
            return $this->cursus;
        }
     
        /**
         * Set etat
         *
         * @param string $etat
         */
        public function setEtat($etat)
        {
            $this->etat = $etat;
        }
     
        /**
         * Get etat
         *
         * @return string 
         */
        public function getEtat()
        {
            return $this->etat;
        }
     
        /**
         * Set entreprise
         *
         * @param Entreprise $entreprise
         */
        public function setEntreprise($entreprise){
            $this->entreprise = $entreprise;
        }
     
        /**
         * Get entreprise
         *
         * @return Entreprise 
         */
        public function getEntreprise(){
            return $this->entreprise;
        }
     
    }
    Si quelqu'un connaît une solution, je suis preneur avant que je ne repasse sur Propel =)
    Merci !

  2. #2
    Membre chevronné
    Profil pro
    Inscrit en
    Février 2009
    Messages
    383
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2009
    Messages : 383
    Par défaut
    Regarde du coté de tes entités de EntrepriseBundle.
    Il y a surement une référence vers Candidat pour laquelle tu as oublié de renseigner la classe avec NS "DOS\CandidatBundle\Entity\Candidat".

Discussions similaires

  1. [C#] Problème d'héritage, aide svp :(
    Par choas dans le forum Windows Forms
    Réponses: 12
    Dernier message: 06/05/2006, 11h46
  2. problème constructeur + héritage
    Par BOLARD dans le forum C++
    Réponses: 10
    Dernier message: 13/04/2006, 08h11
  3. [AS2] Problème d'héritage
    Par wwave dans le forum ActionScript 1 & ActionScript 2
    Réponses: 2
    Dernier message: 27/01/2006, 09h26
  4. Problème d'héritage ?
    Par Romanops dans le forum WinDev
    Réponses: 2
    Dernier message: 16/11/2005, 17h18
  5. Problème d'héritage d'une méthode protégée
    Par shenron666 dans le forum C++
    Réponses: 9
    Dernier message: 28/04/2005, 23h17

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