| Total Complexity | 5 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class NoBeanFoundException extends TDBMException |
||
| 10 | { |
||
| 11 | |||
| 12 | private string $tableName; |
||
| 13 | private string $className; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var string[] |
||
| 17 | */ |
||
| 18 | private array $primaryKeys; |
||
| 19 | |||
| 20 | public static function missPrimaryKeyRecord(string $tableName, array $primaryKeys, string $className, $previous) : self |
||
| 21 | { |
||
| 22 | $primaryKeysStringified = implode(' and ', array_map(function ($key, $value) { |
||
| 23 | return "'".$key."' = ".$value; |
||
| 24 | }, array_keys($primaryKeys), $primaryKeys)); |
||
| 25 | $exception = new self("No result found for query on table '".$tableName."' for ".$primaryKeysStringified, 0, $previous); |
||
| 26 | $exception->tableName = $tableName; |
||
| 27 | $exception->primaryKeys = $primaryKeys; |
||
| 28 | $exception->className = $className; |
||
| 29 | |||
| 30 | return $exception; |
||
| 31 | } |
||
| 32 | |||
| 33 | public static function missFilterRecord(string $tableName) : self |
||
| 34 | { |
||
| 35 | return new self("No result found for query on table '".$tableName."'"); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @return string |
||
| 40 | */ |
||
| 41 | public function getTableName(): string |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return string |
||
| 48 | */ |
||
| 49 | public function getClassName(): string |
||
| 50 | { |
||
| 51 | return $this->className; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return string[] |
||
| 56 | */ |
||
| 57 | public function getPrimaryKeys(): array |
||
| 60 | } |
||
| 61 | |||
| 62 | } |
||
| 63 |