Proposal

Registry should switch reimplement enumerations in a more consistent way.

Options

  1. Maintain the current custom implementation.
  2. Create a custom EnumerationBehavior, attached to Models that have enumerations.
  3. Implement Enumerations at an AppModel/AppTable, and have all relevant Models extend it.
  4. Use PHP SplEnum.
  5. Use CakeDC's Enum Plugin.

Evaluation Criteria

  1. The selected enumeration system must support mapping to database values (eg: StatusEnum::Active → A).
  2. The selected enumeration system must support mapping to language translations (eg: StatusEnum::Active → Active).
  3. The selected enumeration system must support the REST API.
  4. The selected enumeration system must support plugins.
  5. The selected enumeration system must support passing available options to views.
  6. The selected enumeration system should support extended types. (ie: Handle StatusEnum and Identifier::type the same way.)

Benefits

  1. Current enumeration mechanism is a bit hacky, and not really the "Cake" way.

Drawbacks

  1. All enumeration calls may need to be re-implemented.

Conclusion

(question) TBD

  • SplEnum is flagged as Experimental, and so not suitable for selection.

XXX

  • No labels