How to find classes that use certain DB tables

Posted by Songo on Programmers See other posts from Programmers or by Songo
Published on 2013-09-12T09:02:52Z Indexed on 2013/10/18 16:12 UTC
Read the original article Hit count: 199

Problem:
I'm asked to prepare a document where all our DB tables are listed and I'm supposed to list all Controllers that uses these DB tables for read and another list for Controllers that do write operations.

Ex:

     +------------------------------------------+------------+
     |            DB table                      | tbl_Orders |
     +------------------------------------------+------------+
     |Controllers that perform read operations  |    ??      |
     +------------------------------------------+------------+
     |Controllers that perform write operations |    ??      |
     +------------------------------------------+------------+

We are trying to write some documentation for a legacy system built using Zend framework. The code is scattered everywhere. There is code in the Controllers, in the models and even in the views.
The application uses PROPEL as an ORM.

What makes this really difficult is that the Controller may not be directly calling the table, but it may be instantiating a model class that calls that table.

Is there an educated way to approach this crazy task?

Note:

Searching for the table name won't provide a solution because if a model uses that table I wouldn't know which Controller is using that model.

© Programmers or respective owner

Related posts about php

Related posts about documentation