Entities
4 years ago
Formatter
4 years ago
Group
4 years ago
Options
4 years ago
Value
4 years ago
Entities.php
4 years ago
Formatter.php
4 years ago
Group.php
4 years ago
MetaValuesFactory.php
4 years ago
Option.php
4 years ago
OptionGroup.php
4 years ago
Options.php
4 years ago
Paginated.php
4 years ago
Response.php
4 years ago
Value.php
4 years ago
Entities.php
24 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AC\Helper\Select; |
| 4 | |
| 5 | use AC\ArrayIterator; |
| 6 | |
| 7 | class Entities extends ArrayIterator { |
| 8 | |
| 9 | /** |
| 10 | * @param array $entities |
| 11 | * @param Value $value |
| 12 | */ |
| 13 | public function __construct( array $entities, Value $value ) { |
| 14 | $value_entity_map = []; |
| 15 | $entities = array_filter( $entities ); |
| 16 | |
| 17 | foreach ( $entities as $entity ) { |
| 18 | $value_entity_map[ $value->get_value( $entity ) ] = $entity; |
| 19 | } |
| 20 | |
| 21 | parent::__construct( $value_entity_map ); |
| 22 | } |
| 23 | |
| 24 | } |