编辑 make:entity 命令

Edit the make:entity command

我想编辑 Symfony 4 中 MakerBundle 提供的 make:entity 命令。

这里有一个解释:该命令默认在每个实体中添加字段Id。我想自动添加其他字段。这就是为什么我要编辑 make:entity 命令。

我还可以创建一个新的 Bundle,添加一个新的命令,比如 my:make:entity。但是如果我添加一个新命令,我不希望 make:entity 仍然可用。我有一个 OpenSource 项目,我不希望有人使用旧的 make:entity 命令。那么,如果我无法编辑 make:entity 命令,我可以停用它吗?

提前谢谢你,

文森特

您可以从以下位置创建 github 存储库: https://github.com/symfony/maker-bundle

然后进行任何您喜欢的修改,提交并推送到您的分叉。 然后,您需要通过在 composer.json 文件

的末尾添加 "repositories" 部分来告诉作曲家使用您的 fork 而不是官方回购
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/[your github]/maker-bundle"
    }
],

希望对您有所帮助。