Overview of module relations

Hi.

I want to do some special modules. To know if I can reuse some published modules I would like to get an overview of the relations between the modules.
Yes, the database schema I have found (SchemaSpy). However for me it would be more useful to have an ER model to see the concept.
Does somebody knows if there is something like that somewhere?

Thanks for your help.

Peter

Hi Peter,

There are quite a lot of modules in SuiteCRM so a full diagram is very cluttered. However I’ve threw together this function which reads the relationship data in cache to create a graph. This is quickly put together so I make no claims about accuracy or the like but something like:

    function makeGraph(){
        global $beanList, $dictionary;

        $graph = "digraph{\n";
        foreach($beanList as $module => $beanName){
            include "cache/modules/$module/{$module}vardefs.php";
        }
        $graphEntries = array();
        foreach($dictionary as $module => $entry){
            foreach($entry['relationships'] as $relName => $relEntry){
                if(empty($relEntry['lhs_module']) || empty($relEntry['rhs_module'])){
                    continue;
                }
                $graphEntries[] = $relEntry['lhs_module'] . " -> " . $relEntry['rhs_module'] . ";\n";
            }

        }
        $graphEntries = array_unique($graphEntries);
        $graph .= implode('',$graphEntries);
        $graph .= "}";
        return $graph;
    }

Creates a basic graphviz dot file (this only includes links between modules and does’t display cardinality). This can be turned into the attached image but as I mentioned it’s pretty cluttered.

You could probably update the function to ignore certain modules.

Hope this helps,
Jim

Hi Jim

Thanks a lot for your graph function.
That’s exactly what I was looking for.
I’m still a newbie and just learning how to develop for suitecrm. Therefore could you tell me how to integrate your function into my suitecrm installation?

Thanks again.
Peter

Hi,

This depends on where you want to place it, how you want it to be fired e.t.c. The first thing to note is that that function returns a string in graphviz format so you would have to convert that. This isn’t something I’ve done before but googling “php graphviz” should throw up some helpful responses.

Using that code you can create a custom action in a controller which convers the graph string to an image and displays it. Information on custom actions can be found here: http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/03_Module_Framework/01_MVC/03_Controller/

Thanks,
Jim

1 Like

Wow! Super fast answer.
Ok. Thanks. I think I just need the string since there are several programms supporting graphviz for converting in a picture.

Thank you,
Peter