How to override / clone modules that are loaded to the supplier by the composer in zf2?

SO !!!

I added a module zfcUser(but I want to do this with any other module too) in my project based on Zend Framework 2. *. How can I override the controllers / views / configs of this module, so their changes will not be deleted with the dependency update with the composer (I tried to do this and did not find the files that were edited, but what if .... Oo).

I know that there is a way to do this, but I do not know. View helper? Or what?

Help me please! Thank.

ADDITIONAL INFORMATION

Current folders and files ZfcUserOverride:

Current folders and files of ZfcUserOverride

0
2

.

, , ModuleManager " ", ( - config/module.config.php ) ( "modules" application.config.php), : , "".

, "XYZ" "A", "B", "B" "A".

, ZfcUser , .

'modules' => array(
    'ZfcUser',
    'Application',
),

1) ?

, ( zftool ), views/{module name} (views/zfc-user ZfcUser). /{module-name}/view/zfc-user/user/login.phtml - , URL-/user/login: script.

2) ?

, ZfcUser,

'controllers' => array(
    'invokables' => array(
        'zfcuser' => 'ZfcUser\Controller\UserController',
    ),
),

"zfcuser"

                'defaults' => array(
                    'controller' => 'zfcuser', // this refers to the controller service
                    'action'     => 'index',
                ),

ZfcUser , template_path_stack "zfcuser", , , (, ).

ZfcUser UserController, , follow ( )

'controllers' => array(
    'invokables' => array(
        'zfcuser' => 'Application\Controller\UserController',
    ),
),

\Controller\UserController , (, ).

3) ?

"config" , , 2: .

ZfcUser - , , , , , . config/zfcuser.global.php.dist: , .dist, {Application}/config/autoload, ( ). , , , , ...

, , , .

, , , :)

+2

- , , . , zfc-user , YourModule/view/zfc-user/user ZfcUser: login.phtml, register.phtml ..

, ZfcUser. config/application.config.php , ZfcUser 'modules'.

, UserController , ZfcUsers UserController, . , . , MyModule module.config.php , UserController.

Edit UserController ZfcUserOverride. module.config.php zfcuser, ZfcUser.

'controllers' => array(
        'invokables' => array(
            'zfcuser' => 'ZfcUserOverride\Controller\UserController',
        ),            
),

2: module.config.php:

'view_manager' => array(
    'template_path_stack' => array(
        'zfcuser' => __DIR__ . '/../view',
    ),
),

, ZfcUser.

+1

Source: https://habr.com/ru/post/1539234/


All Articles