douke1942 2018-05-14 10:30
浏览 37
已采纳

是否有用于向现有Doctrine实体添加属性的CLI命令?

Just out of sheer laziness, I'm interested in knowing whether there's a command that will allow me to add a single field to an existing Doctrine entity, using prompts similar to the ones that appear when I run doctrine:generate:entity. Does such a command exist?

(For now, I'll go ahead and manually add my property, getters and setters in the entity's PHP file. I'm just curious about whether there's a CLI way to do it.)

  • 写回答

2条回答 默认 最新

  • douqiaoru2583 2018-05-14 12:42
    关注

    Yes, there is. If you are using Syfmony 3.x or Symfony 4 you can install the symfony maker bundle (composer require symfony/maker-bundle).

    Then, you can run the command php bin/console make:entity and select an existing entity name. It will detect that is created and allow you to add fields dynamically.

    UPDATE: And it's not laziness. Code generation tools save time in repetitive tasks and allow you to focus more on your business logic. :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号