Yii Framework Forum: Yii2 Application Flow - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Yii2 Application Flow Build runtime flow of MVC Rate Topic: -----

#1 User is offline   Pierre M 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 28-August 14
  • Location:Belgium

Posted 22 November 2014 - 09:36 AM

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 ;-)

Pierre

PS: Near perfect documentation and phpdoc may come to the rescue, but at the expense of perfect code documentation.
Don't force it. Use a bigger hammer. -- Unix fortune(1)
0

#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,193
  • Joined: 17-January 09
  • Location:Russia

Posted 23 November 2014 - 12:14 PM

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.
Yii 2.0 Development Cookbook

Enjoying Yii? Star us at github

Support me so I can work more on Yii: https://www.patreon.com/samdark
0

#3 User is offline   Pierre M 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 28-August 14
  • Location:Belgium

Posted 24 November 2014 - 10:48 AM

Thanks for the encouragement and the pointers.
I'll have a look when I'm done with this project.
Don't force it. Use a bigger hammer. -- Unix fortune(1)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users