This package is abandoned and no longer maintained. No replacement package was suggested.

Enum module for Zend Framework 2

v0.2.0 2016-07-25 12:04 UTC

This package is auto-updated.

Last update: 2022-11-26 22:10:12 UTC


README

Enum module for Zend Framework 2

Build Status Coverage Status Dependencies Status

Configuration

Adapters

  • Enum\Adapter\DoctrineAdapter (config/enum-doctrine.local.php.dist)
  • Enum\Adapter\ZendDbdapter (config/enum-zenddb.local.php.dist) in progress

Usage

Enumeration data

Enumerations:

id name
1 Civility
2 Status

Enumeration items:

id enum_id value short_name long_name
1 1 1 Mr Mister
2 1 2 Mrs Mistress
3 2 1 Valid Valid
4 2 2 Invalid Invalid

Use view helper to show enumeration value

<?php
// Mister
echo $this->enum(1, 1);

// Mr
echo $this->enum(1, 1, array('mode' => \Enum\EnumManager::SHORT));

// Mistress
echo $this->enum(2, 1);

// Mrs
echo $this->enum(2, 1, array('mode' => \Enum\EnumManager::SHORT));

// Valid
echo $this->enum(1, 2);

// Valid
echo $this->enum(1, 2, array('mode' => \Enum\EnumManager::SHORT));

// Invalid
echo $this->enum(2, 2);

// Invalid
echo $this->enum(2, 2, array('mode' => \Enum\EnumManager::SHORT));