neeckeloo / enum
此包已被 放弃 且不再维护。没有建议替代包。
Zend Framework 2 的 Enum 模块
此包的官方仓库似乎已不存在,因此包已被冻结。
v0.2.0
2016-07-25 12:04 UTC
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
Zend Framework 2 的 Enum 模块
配置
适配器
- Enum\Adapter\DoctrineAdapter (config/enum-doctrine.local.php.dist)
- Enum\Adapter\ZendDbdapter (config/enum-zenddb.local.php.dist) 进行中
使用方法
枚举数据
枚举
id | name |
---|---|
1 | 礼貌 |
2 | 状态 |
枚举项
id | enum_id | value | short_name | long_name |
---|---|---|---|---|
1 | 1 | 1 | 先生 | 先生 |
2 | 1 | 2 | 夫人 | 女士 |
3 | 2 | 1 | 有效 | 有效 |
4 | 2 | 2 | 无效 | 无效 |
使用视图助手显示枚举值
<?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));