S
S
Sergey Beloventsev2017-04-28 16:52:17
Yii
Sergey Beloventsev, 2017-04-28 16:52:17

How to define all models which are connected to behavior?

I want to make an extension for forming a menu through the admin panel. Decided to pass all connected models through a behavior is it possible to define all models that are connected to a behavior? Or at least an algorithm how it can be done? Or maybe there is advice on how to use all the models that the user wants to use. For example
, one wants to connect only categories and static pages, the second changed his mind about more posts, the third is going to create a store and he still needs a product. Maybe based on the design pattern, but then which pattern should be used? I really need advice.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-04-28
@webinar

For the frontend menu, you need to create a separate table and manage the menu through the crud.
Store, static, etc. is done as separate modules, a set of modules is connected in the config.
When creating a menu item, you do a dropdown, where there is a choice of connected modules or an arbitrary link. You can also implement nestedSets here to implement nesting. At the same time, the menu is convenient to manage, it can be cached, etc. And when the module is disabled, the menu item will give a 404 error, not a fatal error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question