Search code examples
doctrine-ormconsolesymfony4

Edit the make:entity command


I would like to edit the make:entity command provided by the MakerBundle in Symfony 4.

Here is an explaination : the command adds the field Id by default in each entity. I would like automatically add other fields. That is why I want to edit the make:entity command.

I can also create a new Bundle that adds a new command like my:make:entity. But if I add a new command, I don't want that make:entity still usable anymore. I have an OpenSource project and I don't want somemone to use the old make:entity command. So, if I can't edit the make:entity command, can I deactivate it ?

Thank you in advance,

Vincent


Solution

  • You can fork the github repository from : https://github.com/symfony/maker-bundle

    and then make any modifications you like, commit and push to your fork. Then you need to tell composer to use your fork instead of the official repo by adding a "repositories" section to the end of your composer.json file

    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/[your github]/maker-bundle"
        }
    ],
    

    I hope this helps.