Enum module for Zend Framework 2
- Enum\Adapter\DoctrineAdapter (config/enum-doctrine.local.php.dist)
- Enum\Adapter\ZendDbdapter (config/enum-zenddb.local.php.dist) in progress
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 |
<?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));