Author Topic: PHP class var qualifier missing ...  (Read 617 times)

adent

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
PHP class var qualifier missing ...
« on: April 20, 2007, 01:32:22 am »
Hi guys!

I´m testing EA right now and tried to generate PHP source code of my model (and suceeded).
The only problem is: Class vars are lacking the needed qualifier "var". Looks like this:
Code: [Select]

class CSomeClass
{
  //This is what comes out:
  $some_uml_generated_var = "foo";
  //This is how it should be:
  var $some_uml_generated_var = "foo";
  ...
  function someFunction()
  {
        //Here it would be correct without "var":
        $some_other_var = "bar";
  }
}

After generating this code I deleted the class from the model, changed the code manually (added "var") and then imported it again. Then I deleted the source code and created it again with the just imported class... and... "var" is missing again.

Can anyone help? Or do I have to add "var" to every class var manually after creating the sources??
Can I change this behaviour somehow in the "Code Generation Templates"?

Kind regards and thanks for any help,
adent.

thomaskilian

  • Guest
Re: PHP class var qualifier missing ...
« Reply #1 on: April 20, 2007, 02:09:41 am »
Hmm. My PHP generates well. Can you tell me what EA version you run. What properties has the class (it is set for PHP, isn't it?). How do the attributes look like?

adent

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: PHP class var qualifier missing ...
« Reply #2 on: April 20, 2007, 02:30:26 am »
I´m evaluating version 6.5.805.
My model is set to generate PHP of course. As I said, the code is generated well. Only the var qualifier is missing. Even if I write the code manually (not touching EA in any way) and then importing this class to a new model, the re-generated code of this class is missing the qualifier again.

The attributes are set as follows:
Type: Tried with and without type "var"
Scope: Tried "Public" as well as "Private"
Stereotype: None
..and all other options left blank or unchecked, too.

Am I missing something?

Regards,
adent.

thomaskilian

  • Guest
Re: PHP class var qualifier missing ...
« Reply #3 on: April 20, 2007, 03:17:52 am »
Ouch. Of course my code generates well. I wrote my own code generation  :-[

Alzheimer, most likely...

Okay then. Check whether PHP 4 is selected in the Tools/Options/Code Gen/PHP

Only for PHP 4 the "var" is expanded. You can have a look into the code gen macro.

adent

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: PHP class var qualifier missing ...
« Reply #4 on: April 20, 2007, 03:36:25 am »
Thank you very much, Thomas! You´re my hero of the day (and maybe the next few, too) :D
I really like EA and the option to work with PHP made me evaluating it, but this was really annoying. Now I´m convinced and willing to pay for it!

Have a nice day!
Regards, Dirk.

PS: Wie gut, daß auch andere Softies manchmal zugeben, daß sie an Alzheimer leiden *LOL Grüße aus Südbaden...

Simon M

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6190
  • Karma: +47/-5
    • View Profile
Re: PHP class var qualifier missing ...
« Reply #5 on: May 09, 2007, 02:11:44 pm »
I've had a look at this.  It appears that the option for PHP version currently load a default version.  As a result the code templates are generating invalid code for attributes until the PHP version has been set in any model.

We'll fix this for a future version of EA.  In the mean time, you'll need to ensure that you have correctly set the PHP version before generating PHP code.
Simon

support@sparxsystems.com

adent

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: PHP class var qualifier missing ...
« Reply #6 on: May 11, 2007, 02:00:02 am »
After your post I switched back to "PHP5", but then the qualifier is missing again. So for me it DOES matter if I set it to v4 or v5...

But anyway: EA is a great piece of software for a fair price! Compliments to all involved people.

Regards, Dirk.

Simon M

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6190
  • Karma: +47/-5
    • View Profile
Re: PHP class var qualifier missing ...
« Reply #7 on: May 13, 2007, 01:05:32 pm »
PHP 5 doesn't use the var qualifier.  In its place should be the scope of the attribute.
Simon

support@sparxsystems.com