Book a Demo

Author Topic: PHP Code Generation  (Read 3511 times)

thomaskilian

  • Guest
PHP Code Generation
« on: March 10, 2006, 09:52:50 am »
Hi there,
has anyone experienced a change in the code gen for PHP with one of the recent releases? I now get a require_once('var.php') if I have declared an attribute in a class. When I traced it down, I found that the macro %fileImports% actually expands more than just the input box from the code gen window. I'd like to hear some feedback before sending a bug report.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: PHP Code Generation
« Reply #1 on: March 13, 2006, 03:22:29 pm »
How recent changes are you thinking?

The fileImports macro also generates a imports (require_once for PHP) for any attributes with the type classifier set, associations, generalizations or realisations to another class.  As far as I know it has always added statements in these conditions.

Some time over a year ago it was extended to also generate imports for operation return type and parameters with the type classifier set.

So, if your PHP attribute has a type set to a class in your model, then it's working as expected.
« Last Edit: March 13, 2006, 03:24:48 pm by simonm »

thomaskilian

  • Guest
Re: PHP Code Generation
« Reply #2 on: March 14, 2006, 01:44:25 pm »
Hi Simon,
I'm not sure whether I used my own templates before :-/ However, when using the native generation I receive a require_once('var.php') which does not make sense since 'var' is only a dummy type. I also modified the template to only expand the fileImports without all the other stuff. To my surprise I noticed that it generated (almost) the same stuff as with the complete macros ??? I simply changed the macro to behave as I like it, but am curious whether this is intended.