Page 1 of 2

PHP function

PostPosted: Tue 13 Oct 2015 10:09
by parodid
Dear Mr. Pagès

I think there is a bug in PHP code generation for function parameters.
When I declare a parameter inout in C++, BoUML automatically add & (passing by reference) operator.
When I do the same thing in PHP the parameter continue to be passed by value.

Best regards.

D.Parodi

Re: PHP function

PostPosted: Tue 13 Oct 2015 11:59
by Bruno Pagès
Dear Mr. Parodi

You are right, to add the '&' when a parameter is out or inout seems a good idea

Note I plan to manage soon new features of PHP 7 : the optional return type on functions, and the new use form with '{' '}'

PHP 5 added the optional type for the parameters, but currently I do not put the ${t<i>} by default. How to introduce the type for parameters and return type of PHP 7, to force them in any case or to add a flag through the generation setting to do or not (may be through the choose of the php version old/5/7) ?

P.S. The missing '&' is not a 'bug', it is just I never think about that ;)

Re: PHP function

PostPosted: Wed 14 Oct 2015 12:07
by parodid
Dear Mr. Pagès,

Currently I don't even think to use PHP 7 because I'm bonded to the versions of LAMP or WAMP my company provides.
Nevertheless, in my opionion it would be a great idea to customize code generation configuration according to the target language revision number.
Another possibility could be flagging project enitities as exportable or not in code generation on that parameter base.
I'm aware this could mean a huge work but having both features would be the best, and not only for PHP language, of course.

Best regards.

Re: PHP function

PostPosted: Sun 18 Oct 2015 19:02
by Bruno Pagès
The release 6.9 is available, implementing your request, please refer to http://www.bouml.fr/historic.html

Re: PHP function

PostPosted: Tue 27 Oct 2015 07:39
by parodid
Dear Mr. Pagès

I think I've found another issue in PHP parameter code generation.
If I declare a parameter, let's say a variable named "extra" having an empty string as default value, i.e., bouml generates:

public static function func( ...., $extra = '' = '')
{
${body}}

In other words the default value is repeated 2 times.
Luckily, clicking "Default definition" button, the error disappears.

Best regards

Re: PHP function

PostPosted: Tue 27 Oct 2015 16:58
by Bruno Pagès
The only way to have that result is to set the default value both in the UML tab and at the Php definition level ( .... ${(}${t0} ${p0}${v0} = ''${)} ... ) and doing that is wrong because the default value is generated first by ${v0} then by the =''

The right way is to put '' as the value in the Uml Tab (the = is automatically added), when you use the button "default definition" the extra ='' is removed from the definition

Re: PHP function

PostPosted: Wed 28 Oct 2015 08:24
by parodid
Dear Mr. Pagès,

Sorry but I can't understand your answer.
I'm pretty sure that it cannot be my error and as a matter of fact I attach a test project created with BoUML 6.9 leaving all generation settings to their default values.
Please consider generated code in Php tab of the Operation dialog for function Test::test.

Best regards

Re: PHP function

PostPosted: Wed 28 Oct 2015 11:43
by Bruno Pagès
Dear Mr. Parodi

Oh yes, when you enter the name of a new parameter its definition contains two times ${v<i>}, and the duplication is removed when settings the type or using the button default definition

I will fix that, thank you for the report

Re: PHP function

PostPosted: Wed 28 Oct 2015 17:30
by Bruno Pagès
Please find in advance Bouml_6.9.1_setup.exe before I deliver the other packages soon

Re: PHP function

PostPosted: Thu 29 Oct 2015 11:01
by parodid
All behaves as expected, now.
Many thanks.