Author Topic: UML class diagrams from PHP classes?  (Read 3819 times)

marzagao

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
UML class diagrams from PHP classes?
« on: January 22, 2003, 01:31:53 pm »
Does anybody know if Enterprise Architect (or any other tool) will support reverse engineering and/or code generation of PHP classes?

Thanks.


PhilR

  • EA User
  • **
  • Posts: 87
  • Karma: +0/-0
    • View Profile
Re: UML class diagrams from PHP classes?
« Reply #1 on: January 22, 2003, 11:26:02 pm »
The simnple answer is no.

However, Sparx have mentioned that a future version of EA will provide user-defined code templates.  When this happens you can either define your own PHP templates or wait for someone else to.

Another possibility is to use the automation interface to write your own code generator.

I have used PHP to access the automation inetrface as a COM object.  It is not too difficult to do this but requires a bit of digging about in the PHP and EA documentation.

I have pasted a "hello world" version of the code below.

Phil

<?php

$ea = new COM("EA.Repository") or die("Can't open EA");
$ea->OpenFile("C:\pathname to EA model...");

for ($m=0; $m<$ea->Models->Count; $m++){
   $model=$ea->Models->GetAt($m);
   echo "<h1>$model->Name</h1><br>";
   for ($p=0; $p<$model->Packages->Count; $p++) {
       $package=$model->Packages->GetAt($p);
       echo "<h2>$package->Name</h2><br>";
       for ($e=0; $e<$package->Elements->Count; $e++) {
           $element=$package->Elements->GetAt($e);
           echo "<h3>$element->Name</h3><br>";
       }

   }
}

$ea->Exit();

?>

marzagao

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Re: UML class diagrams from PHP classes?
« Reply #2 on: January 23, 2003, 06:45:29 pm »
Hey Phil,

Thanks for the quick reply. I guess I'll have to look for other tool as of now. :)