Yii2 Application Flow

Dear Yiiers,

Here I have my nice simple order and work management app, made of a dozen of models, half a dozen of modules, each consisting of views and controllers.

Views are mainly composed of other, smaller views.

Even with this small project, I’m getting lost in my own design :-/.

When I refactor a view, it is difficult to know which actions or views were using it. Of course I used ‘convention’ like subview names start with underscore, views called by action do not start with underscore, etc. Views are confined in their modules, etc.

Sooo, I was wondering if Yii couldn’t, one more time, come to my rescue…

Would it be possible to design something that I would call a Yii-app crawler, that would look into modules, controller, actions, and views to build a “flow” diagram, with which controller action calls which view(s), which view render which 'sub’views, etc. For instance, CRUD produced with gii would look like:

indexAction renders index

viewAction renders view

createAction renders create renders _form

updateAction renders update renders _form

deleteAction renders index

and so on.

I understand that there often are condition like in actionActive if true, render view A, if not, render view B, but the diagram could at least tell me that actionActive may render views A and/or view B.

Is such a crawler feasible (given Yii’s design).

Would it be difficult to make?

What would a nice place to start be?

I know, application should always start with a goood, perfect, design, and programmers should program as designed and NEVER otherwise.

But what if it happens to not be the case. Can Yii help?

Don’t you think such a tool could come to the rescue of bad programmer :wink:

Pierre

PS: Near perfect documentation and phpdoc may come to the rescue, but at the expense of perfect code documentation.

Such crawler is possible. Would be relatively diffcult to implement so I don’t think core team will handle it because of time constraints. I’d use PHP tokenizer for such analyzer.

Non-perfect stuff is OK since noone could ever be absolutely perfect.

Thanks for the encouragement and the pointers.

I’ll have a look when I’m done with this project.