2017-09-13 106 views
0

从我现有的大型(超过100个实体)MySQL数据库创建yaml元数据后,我想创建没有注释的php实体类。根据我的理解,人们只能使用三种可能格式中的一种。我使用yaml,并且不想删除php实体文件中的所有注释行。从MySQL数据库创建实体

我错过了什么吗?有没有一个参数来完成这个?这里是我的实体创建命令:

php bin/console doctrine:generate:entities AppBundle --path ./src 

感谢您的任何想法 H. Stoellinger

+0

你对你提到的命令有什么疑问? – zizoujab

+0

过去一段时间,因为我已经使用了生成实体。这个链接:https://symfony.com/doc/current/doctrine/reverse_engineering.html似乎建议使用原则:映射:导入遵循原则:映射:转换 – Cerad

回答

0

首先 - 感谢您的关注!请参阅下面的文档中所述的实体创建过程。一切都是(或多或少!)很好,除了 - 我看到它 - 我不仅以yaml格式(这是我想要的)获取元数据描述,而且还创建实体php中的注释行-files。也许我错过了一些东西,但是我对Symfony的“入门级”知识使我怀疑生成注释行是多余的。我希望它被压制 - 如果可能的话。

-------------------------------- 
file src/AppBundle/Resources/config/doctrine/Vips.orm.yml 
------------------------------- 
AppBundle\Entity\Vips: 
    type: entity 
    table: vips 
    indexes: 
     persNr: 
      columns: 
       - persNr 
     codeKat: 
      columns: 
       - codeKat 
    uniqueConstraints: 
     nummer: 
      columns: 
       - nummer 
    id: 
     nummer: 
      type: integer 
      nullable: false 
      options: 
       unsigned: false 
      id: true 
     datvon: 
      type: date 
      nullable: false 
      options: 
       default: '1999-09-01' 
      id: true 
      column: datVon 
    fields: 
     vvip: 
      type: smallint 
      nullable: true 
      options: 
       unsigned: false 
       default: '0' 
      column: vVip 
     spezbeh: 
    .... 

------------------------------- 
file src/AppBundle/Entity/vips.php 
------------------------------- 
<?php 

    namespace AppBundle\Entity; 

    /** 
    * Vips 
    **/ 
    class Vips 
{ 

/** 
    * @var integer 
    */ 
    private $nummer; 

/** 
    * @var \DateTime 
    */ 
private $datvon = '1999-09-01'; 

/** 
    * @var integer 
    */ 
private $vvip = '0'; 

/** 
    * @var integer 
    */ 
private $spezbeh = '0'; 
...