How to find classes that use certain DB tables
- by Songo
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.