vova07 / yii2-start

Yii2-Start application
Other
273 stars 115 forks source link

Override models #112

Closed nunomaduro closed 9 years ago

nunomaduro commented 9 years ago

Hey,

Override views - OK Override controllers - OK Override models - i can't do that.

Question: What is the best option to override models ?

vova07 commented 9 years ago

You can use classMap or DI. But now I understood this is not so flexible, and I'll update all modules with new model style. I'll come back with some updates soon.

nunomaduro commented 9 years ago

Right now i am creating new models extending some of your module models, and I only override the methods that I need.

timmy78 commented 9 years ago

I don't understand how to override controllers, views and models; can you show me an example please ? :(

I want to override the backend login view and the backend GuestController.

I just want to add a captcha in backend login. There is no documentation for these things...

I did something like this :

'view' => [
  //'theme' => 'vova07\themes\admin\Theme'
  'theme' => [
    'pathMap' => [
      '@vova07/users/views/backend/guest' => '@backend/views/users/guest'
    ],
  ],
],

Thanks !

nunomaduro commented 9 years ago

The best thing is not that. You can create your own modules that extend from vova07 modules. And after that u can override whatever you want.