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.
1
I think you’ll need a tiered search approach.
First round is the obvious one that you call out in your question. Specifically, search for the table names within the code itself.
The second round is where it gets more difficult. You’ll need to know the names of the functions that you found from the first round of searching. Then search for all of the areas where those functions are being called.
Combine the results of the second set of answers with the first set and you should be able to identify all of your areas of concern.