| Conditions | 4 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | protected function lookupKey( |
||
| 25 | int $key, |
||
| 26 | RecordInterface $record, |
||
| 27 | ContextualCommandInterface $command = null |
||
| 28 | ) { |
||
| 29 | $key = $this->key($key); |
||
| 30 | |||
| 31 | if (!empty($command)) { |
||
| 32 | $context = $command->getContext(); |
||
| 33 | if (!empty($context[$key])) { |
||
| 34 | //Key value found in a context |
||
| 35 | return $context[$key]; |
||
| 36 | } |
||
| 37 | |||
| 38 | if ($key == $this->primaryColumnOf($record)) { |
||
| 39 | return $command->primaryKey(); |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | //Fallback lookup in a record |
||
| 44 | return $record->getField($key, null); |
||
| 45 | } |
||
| 46 | |||
| 64 | } |