Skip to content

enumeration values as constants #28

@ivoba

Description

@ivoba

What about generating class stubs for enummeration simple types and adding enumeration values as constants to the class?
This would help in building the entities as possible values would be available from Code.
Validation of this values is a similar but different issue, though.

<xsd:simpleType name = "GenderType">
    <xsd:restriction base = "xsd:string">
      <xsd:enumeration value = "Male"/>
      <xsd:enumeration value = "Female"/>
    </xsd:restriction>
  </xsd:simpleType>
class GenderType {
    const MALE = 'Male';
    const FEMALE = 'Female';
}

Or even maybe add it to the owner class. This would mean a bit of redundancy but the relation from property to SimpleType would be more clear.

class Person {
    /** simpleType GenderType*/
    const GENDER_MALE = 'Male';
    const GENDER_FEMALE = 'Female';

     /**
     * @property string $gender
     */
    private $gender = null;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions