fluent-booking
/
vendor
/
wpfluent
/
framework
/
src
/
WPFluent
/
Database
/
Orm
/
ModelNotFoundException.php
ModelNotFoundException.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution 1.5.21, at vendor/wpfluent/framework/src/WPFluent/Database/Orm/ModelNotFoundException.php
| 1 | <?php |
| 2 | |
| 3 | namespace FluentBooking\Framework\Database\Orm; |
| 4 | |
| 5 | use FluentBooking\Framework\Support\Arr; |
| 6 | use FluentBooking\Framework\Database\RecordsNotFoundException; |
| 7 | |
| 8 | class ModelNotFoundException extends RecordsNotFoundException |
| 9 | { |
| 10 | /** |
| 11 | * Name of the affected Orm model. |
| 12 | * |
| 13 | * @var string |
| 14 | */ |
| 15 | protected $model; |
| 16 | |
| 17 | /** |
| 18 | * The affected model IDs. |
| 19 | * |
| 20 | * @var int|array |
| 21 | */ |
| 22 | protected $ids; |
| 23 | |
| 24 | /** |
| 25 | * Set the affected Orm model and instance ids. |
| 26 | * |
| 27 | * @param string $model |
| 28 | * @param int|array $ids |
| 29 | * @return $this |
| 30 | */ |
| 31 | public function setModel($model, $ids = []) |
| 32 | { |
| 33 | $this->model = $model; |
| 34 | $this->ids = Arr::wrap($ids); |
| 35 | |
| 36 | $this->message = "No query results for model [{$model}]"; |
| 37 | |
| 38 | if (count($this->ids) > 0) { |
| 39 | $this->message .= ' '.implode(', ', $this->ids); |
| 40 | } else { |
| 41 | $this->message .= '.'; |
| 42 | } |
| 43 | |
| 44 | return $this; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Get the affected Orm model. |
| 49 | * |
| 50 | * @return string |
| 51 | */ |
| 52 | public function getModel() |
| 53 | { |
| 54 | return $this->model; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Get the affected Orm model IDs. |
| 59 | * |
| 60 | * @return int|array |
| 61 | */ |
| 62 | public function getIds() |
| 63 | { |
| 64 | return $this->ids; |
| 65 | } |
| 66 | } |
| 67 |