Skip to content

Commit 097805f

Browse files
committed
feat: UserIdentityModel::update() throws Exception
1 parent b8b6855 commit 097805f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Models/UserIdentityModel.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use CodeIgniter\Shield\Entities\User;
1414
use CodeIgniter\Shield\Entities\UserIdentity;
1515
use CodeIgniter\Shield\Exceptions\LogicException;
16+
use CodeIgniter\Shield\Exceptions\ValidationException;
1617
use Faker\Generator;
1718

1819
class UserIdentityModel extends Model
@@ -362,6 +363,26 @@ public function forceGlobalPasswordReset(): void
362363
$this->checkQueryReturn($return);
363364
}
364365

366+
/**
367+
* Override the Model's `update()` method.
368+
* Throws an Exception when it fails.
369+
*
370+
* @param array|int|string|null $id
371+
* @param array|object|null $data
372+
*
373+
* @return true if the update is successful
374+
*
375+
* @throws ValidationException
376+
*/
377+
public function update($id = null, $data = null): bool
378+
{
379+
$result = parent::update($id, $data);
380+
381+
$this->checkQueryReturn($result);
382+
383+
return true;
384+
}
385+
365386
public function fake(Generator &$faker): UserIdentity
366387
{
367388
return new UserIdentity([

0 commit comments

Comments
 (0)