Question

I have a bundle that I want change some codes to fit my needs.

Is it normal to make my changes in the vendor repository or I have to do otherwise?

Was it helpful?

Solution

No, you should avoid ever making changes to your vendors because the next time you try to update those bundles you may lose your changes or get conflicts. Also your vendors will (or at least should) be ignored by your version control system so those changes will not get carried over when you deploy to new environments.

The idea of a bundle is for it to be self sufficient and serve it's own purpose. If there is an issue with the bundle then you should report the bug, or alternatively the make the necessary change(s), make a pull request and if it is merged in you can then update via composer to get the latest change.

If you simply wish to extend or overwrite functionality then you should do this in your app by following the guides laid out in the Cookbook (links below).

http://symfony.com/doc/current/cookbook/bundles/inheritance.html

http://symfony.com/doc/current/cookbook/bundles/override.html

OTHER TIPS

Normally, you can "overwrite" code by duplicating the file in the app/ directory.

For example, i have a file that i have edited for FosUserBundle that resides in

/app/Resources/FOSUserBundle/views/layout.html.twig

I don't know if that works for classes and stuff.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top