Bug 379187 - PHP class generation from code fails
Summary: PHP class generation from code fails
Status: RESOLVED DUPLICATE of bug 148911
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 2.21.3 (KDE Applications 16.12.3)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-25 10:52 UTC by Clemens John
Modified: 2017-05-02 06:07 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Example of PHP file from which generating an UML class fails. (1.77 KB, application/x-php)
2017-04-25 10:52 UTC, Clemens John
Details
xmi test file (13.78 KB, application/x-uml)
2017-04-25 16:21 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Clemens John 2017-04-25 10:52:34 UTC
Created attachment 105183 [details]
Example of PHP file from which generating an UML class fails.

Hi,

I am using the latest Umbrello version 2.22.0 on Archlinux. I'm trying to generate an UML class from PHP code (PHP5 compatible) but it fails with various errors in the log complaining about the code syntax. The only thing I will get is a "file"-entity in the components view but there should be a "class"-entity in the logical view I think.

Generating UML classes from java source works as expected. I'll attach you an example of the failing file so you can try yourself.

Best whishes
Clemens
Comment 1 Ralf Habacker 2017-04-25 16:21:12 UTC
Created attachment 105188 [details]
xmi test file

I created an xmi file from inspecting attachment 105183 [details], which indicates that attachment 105183 [details] seems not to be generated by umbrello.

Running generated code from this xmi file e.g. 

php <umbrello-code-output-dir>/TimeTracker/Base/Models/Hour.php

returns 

PHP Warning:  require_once(ApiServer/Modules/Models/BaseModel.php): failed to open stream: No such file or directory in /home/xxx/uml-generated-code/TimeTracker/Base/Models/Hour.php on line 2

which could be fixed with setting the php variable include_path

cd /home/xxx/uml-generated-code/TimeTracker/Base/Models/
php  -d include_path=../../../ Hour.php

to resolve the relative path.
Comment 2 Clemens John 2017-04-25 16:41:54 UTC
Hi Ralph,

thanks for your reply. You are right the file https://bugs.kde.org/attachment.cgi?id=105183 was not generated using Umbrello. It was created manually by me. Maybe there is a misunderstanding so I'll try to clarify what I'm trying to do to make shure we are talking about the same topic.

I'm trying to reverse engineer php files containing php classes manually created by me to automatically have them available as UML classes in Umbrello. In most cases there will be imports (use statements) of classes which are not directly available to Umbrello but reverse engineering should work nevertheless.

During my research I found the Pear PHP_UML package [1] which generates an *.xmi file I can open using Umbrello using the following command:

phpuml ./packages/timetracker/base/src/Models/Hour.php -o ./test.xmi

This works quite well as a workaround and I think this is what the "Code Importing Wizard" should do out of the box if PHP is selected as language.

[1] https://pear.php.net/manual/en/package.php.php-uml.php

Best whises
Clemens
Comment 3 Ralf Habacker 2017-05-02 06:07:35 UTC

*** This bug has been marked as a duplicate of bug 148911 ***