| 1 | <?php |
||
| 16 | class LocalizedEnumCollection extends Collection |
||
| 17 | { |
||
| 18 | const KEY = 'key'; |
||
| 19 | |||
| 20 | protected $type = '\Commercetools\Core\Model\Common\LocalizedEnum'; |
||
| 21 | |||
| 22 | 4 | protected function indexRow($offset, $row) |
|
| 23 | { |
||
| 24 | 4 | if ($row instanceof LocalizedEnum) { |
|
| 25 | 2 | $key = $row->getKey(); |
|
| 26 | } else { |
||
| 27 | 3 | $key = $row[static::KEY]; |
|
| 28 | } |
||
| 29 | 4 | $this->addToIndex(static::KEY, $offset, $key); |
|
| 30 | 4 | } |
|
| 31 | |||
| 32 | /** |
||
| 33 | * @param $key |
||
| 34 | * @return static |
||
| 35 | */ |
||
| 36 | public function getByKey($key) |
||
| 40 | } |
||
| 41 |