MathewWi / umple

Automatically exported from code.google.com/p/umple
0 stars 0 forks source link

Php code generation for get methods - duplication #649

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Given class 

class X {}
class Y {
 3 ym_1 -- 1 X x;
}

the generated code in class Y contains the following (in php):

...

  public function getYm_1($index)
  {
    $aYm_1 = $this->ym_1[$index];
    return $aYm_1;
  }

  public function getYm_1()
  {
    $newYm_1 = $this->ym_1;
    return $newYm_1;
  }

...

this results in an error, since php function signatures are only dependent on 
their names and not on the parameters - so, this results in an error in 
function declaration (this is classified as a redeclaration).

Original issue reported on code.google.com by ellen.ar...@gmail.com on 28 Oct 2014 at 7:32

GoogleCodeExporter commented 9 years ago
I think I've fixed this now... I changed the getMany jet file (for 
associations) to generate `getYm_1_index($index)` and `getYm_1()` so the names 
are different.  However, this resulted in compiler errors in other php tests 
where the original naming convention was used, so I had to fix all those.

Should make a commit for this in the next few days (probably combined with a 
bigger commit for issue 183).
I'll keep updating!

Original comment by ellen.ar...@gmail.com on 29 Oct 2014 at 3:25

GoogleCodeExporter commented 9 years ago
So I made a commit for issue 183 which included a fix for this... this is 
revision 4678.
Like I explained above, I changed the getMany jet file for associations for php 
to generate different names for the methods.  I also had to change a lot of the 
template tests for php code generation because of this new syntax, along with 
various testbed tests that reference it.

Original comment by ellen.ar...@gmail.com on 30 Oct 2014 at 10:02

GoogleCodeExporter commented 9 years ago

Original comment by ellen.ar...@gmail.com on 4 Nov 2014 at 5:30

GoogleCodeExporter commented 9 years ago

Original comment by ellen.ar...@gmail.com on 28 Nov 2014 at 10:43