2

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
  • Is there no way to probe this mess? Why not use a database profiler and record all the calls. Then exercise the controllers in a methodical fashion through scaffolding and track the resulting database hits. That should give some good coverage and you may miss some when you haven't exercised all the possible code branches but it should give you a head start and identify areas to further inspect visually. Commented Sep 12, 2013 at 16:05

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.