Génération d'entités d'après des metadata
Bonjour à tous,
Je cherche depuis un bon moment maintenant mais je ne trouve pas de solution à mon soucis, alors je me permet de venir directement demander de l'aide.
Voici mon soucis :
J'ai une base de données existantes et je souhaite générer les entités correspondantes.
J'ai généré les metadata au format XML et ai rajouté à la main les informations de mapping comme indiqué dans ce tuto : http://symfony.com/fr/doc/current/co...gineering.html
Lorsque j'exécute la commande php app/console doctrine:mapping:import TUAAnnonceBundle annotation
Il me génère les classes php mais sans le mapping...
Voici un exemple avec la table categorie :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Jbgdu31categorie" table="jbgdu31categorie">
<one-to-many field="bgcatannonces" target-entity="Jbgdu31annonce" mapped-by="bganncategorie" />
<one-to-many field="bgcatchampscategories" target-entity="Jbgdu31champscategorie" mapped-by="bgchacategorie" />
<one-to-many field="bgcatchildren" target-entity="Jbgdu31categorie" mapped-by="bgcatparent" />
<many-to-one field="bgcatparent" target-entity="Jbgdu31categorie" inversed-by="bgcatchildren" />
<id name="bgcatid" type="integer" column="bgcatid">
<generator strategy="IDENTITY"/>
</id>
<field name="bgcatnomcategorie" type="string" column="bgcatnomcategorie" length="50" nullable="false"/>
<field name="bgcatpere" type="integer" column="bgcatpere" nullable="false"/>
</entity>
</doctrine-mapping> |
Et voici la classe php générée :
Code:
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
| <?php
namespace TUA\AnnonceBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Jbgdu31categorie
*
* @ORM\Table(name="jbgdu31categorie")
* @ORM\Entity
*/
class Jbgdu31categorie
{
/**
* @var integer
*
* @ORM\Column(name="bgcatid", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $bgcatid;
/**
* @var string
*
* @ORM\Column(name="bgcatnomcategorie", type="string", length=50, nullable=false)
*/
private $bgcatnomcategorie;
/**
* @var integer
*
* @ORM\Column(name="bgcatpere", type="integer", nullable=false)
*/
private $bgcatpere;
} |
J'ai vérifié 15 fois mais je ne vois pas d'où ça vient...
Quelqu'un aurait-il une solution ?
Je vous remercie !