Forums OroPlatform How to override parts of oro

This topic contains 6 replies, has 3 voices, and was last updated by  kenzoj 6 months ago.

  • Creator
  • #31223

    Mike Kudelya


    Today i want to explain how to override parts of oro.

    • First of all create Custom (for example) namespace directory – src/Custom.
    • Create directory for bundle which you want to override – src/Custom/Bundle/FilterBundle
    • Create src/Custom/Bundle/FilterBundle/CustomFilterBundle.php which contains getParent() function. Our new bundle will know who its parent:
    • Register your bundle by creating Resources/config/oro/bundles.yml in your custom bundle with following content (this example i got from UIBundle, please change to right path)

      Now we have new bundle ready to override parent’s bundle.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
  • #31224

    Mike Kudelya

    To override controller, create bundle similar to CustomFilterBundle and extent it from OroDashboardBundle.

    • Create src/Custom/Bundle/DashboardBundle/Controller/DashboardController.php controller and override index action.
    • Don’t forget create file src/Custom/Bundle/DashboardBundle/Resources/config/oro/routing.yml and override oro_dashboard alias with new controller location

    Mike Kudelya

    Suppose we want to override javascript file.

    Create it, for example i want to override choice-tree-filter.js – src/Custom/Bundle/FilterBundle/Resources/public/js/filter/choice-tree-filter.js

    and register it in src/Custom/Bundle/FilterBundle/Resources/config/requirejs.yml


    Mike Kudelya

    Please run these commands after javascript changes

    and this command after yml modifications


    Mike Kudelya

    Today we are talking about service overriding. To override service you must create own bundle, after that there is two ways. The example override Oro\Bundle\ImportExportBundle\Reader\EntityReader service.


    Create your custom entity reader

    Add to src/Custom/Bundle/OroBundle/Resources/config/reader.yml these lines (‘oro_importexport.reader.entity.class’ parameter must be the same that in original class, change only path to class):

    and register reader.yml in src/Custom/Bundle/OroBundle/DependencyInjection/CustomOroExtension.php

    Second (via compiler pass):

    and register it in CustomOroBundle.php



    Hi Mike,

    I want to override the execute methode of the console command “oro:magento:initial:sync”.
    I have create bundle inherit from MagentoBundle and override InitialSyncCommand but the parent command is still executed but not mine. My bundle is loaded after the OroMagentoBundle.
    How can I solve the problem ?



    How did you declare the bundle in bundles.yml?

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.