src/services/traits/ModelByString.php 1 location
|
@@ 128-140 (lines=13) @@
|
| 125 |
|
* @param string|null $toScenario |
| 126 |
|
* @return BaseModel|null |
| 127 |
|
*/ |
| 128 |
|
public function freshFindByString(string $string, string $toScenario = null) |
| 129 |
|
{ |
| 130 |
|
|
| 131 |
|
// Find record in db |
| 132 |
|
if (!$record = $this->findRecordByString($string)) { |
| 133 |
|
return null; |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
$model = $this->create($record, $toScenario); |
| 137 |
|
|
| 138 |
|
return $model; |
| 139 |
|
|
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
/** |
| 143 |
|
* @param string $string |
src/services/traits/ObjectByString.php 1 location
|
@@ 128-140 (lines=13) @@
|
| 125 |
|
* @param string|null $toScenario |
| 126 |
|
* @return BaseObject|null |
| 127 |
|
*/ |
| 128 |
|
public function freshFindByString(string $string, string $toScenario = null) |
| 129 |
|
{ |
| 130 |
|
|
| 131 |
|
// Find record in db |
| 132 |
|
if (!$record = $this->findRecordByString($string)) { |
| 133 |
|
return null; |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
$model = $this->create($record, $toScenario); |
| 137 |
|
|
| 138 |
|
return $model; |
| 139 |
|
|
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
/** |
| 143 |
|
* @param string $string |