neeckeloo / enum
Enum module for Zend Framework 2
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 1 645
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 2
Open Issues: 1
Requires
- php: ^5.6 || ^7.0
- container-interop/container-interop: ^1.1.0
Requires (Dev)
- doctrine/dbal: ~2.4
- phpunit/phpunit: ~5.4
- satooshi/php-coveralls: dev-master
- zendframework/zend-servicemanager: ~2.5
- zendframework/zend-stdlib: ~2.5
- zendframework/zend-view: ~2.5
README
Enum module for Zend Framework 2
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));