New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Associations between a class and a class heirarchy causes association variable duplication in PHP #599

Open
Nava2 opened this Issue Aug 26, 2015 · 2 comments

Comments

Projects
None yet
4 participants
@Nava2
Member

Nava2 commented Aug 26, 2015

Originally reported on Google Code with ID 701


What steps will reproduce the problem?

  1. The following example demonstrates the issue:

// Here we define our base classes
class Vehicle {}
class Wheel {}

// Here we define our subclasses
class Bicycle { isA Vehicle; }
class Unicycle { isA Vehicle; }

association { 0..1 Vehicle vehicle -- 0..* Wheel wheel; }

association { 0..1 Bicycle vehicle -- 0..2 Wheel wheel; }
association { 0..1 Unicycle vehicle -- 0..1 Wheel wheel; }

  1. Notice how this declares 3 different associations with Wheel, but Wheel should always
    just have zero or one vehicle.
  2. Here's a snippet of the PHP code this generates:

class Wheel
{

//------------------------
// MEMBER VARIABLES
//------------------------

//Wheel Associations
private $vehicle;
private $vehicle;
private $vehicle;

//------------------------
// CONSTRUCTOR
//------------------------

public function __construct()
{}

This fails a PHP lint due to the redeclaration of the Wheel::$vehicle variable.


Reported by @CraigBryan on 2015-04-07 13:32:08

@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

Once this issue is fixed, a @@@skipphpcompile flag should be removed from the following
file, so it can be included in testing:

assocSpecEx.ump


Reported by @CraigBryan on 2015-04-08 14:16:49

@vahdat-ab

This comment has been minimized.

Member

vahdat-ab commented Jan 4, 2016

It's a valid bug. This is working well in the generated code for Java. Therefore, more information about how to implement this in Php can be achieved from the generated code for Umple. The generated APIs for PHP should also be modified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment