ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

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

  • Creator
    Topic
  • #20555
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi,

    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
    Replies
  • #20556
    Mike Kudelya
    Mike Kudelya
    Oro Core

    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
    #20566
    Mike Kudelya
    Mike Kudelya
    Oro Core

    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

    #20590
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Please run these commands after javascript changes

    and this command after yml modifications

    #23067
    Mike Kudelya
    Mike Kudelya
    Oro Core

    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.

    First:

    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

    #35288
    adriwan_kenoby
    adriwan_kenoby
    Participant

    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 ?

    #35448

    kenzoj
    Participant

    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.