-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support custom ModelManagerException messages (#8141)
Co-authored-by: Vincent Langlet <[email protected]>
- Loading branch information
1 parent
1df71c0
commit 8b47fe7
Showing
4 changed files
with
557 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/App/Controller/CustomModelManagerExceptionMessageController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Sonata Project package. | ||
* | ||
* (c) Thomas Rabaix <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sonata\AdminBundle\Tests\App\Controller; | ||
|
||
use Sonata\AdminBundle\Controller\CRUDController; | ||
|
||
/** | ||
* @phpstan-extends CRUDController<object> | ||
*/ | ||
final class CustomModelManagerExceptionMessageController extends CRUDController | ||
{ | ||
public const ERROR_MESSAGE = 'message from model manager exception'; | ||
|
||
protected function handleModelManagerException(\Exception $exception): string | ||
{ | ||
return self::ERROR_MESSAGE; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
tests/App/Controller/CustomModelManagerThrowableMessageController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Sonata Project package. | ||
* | ||
* (c) Thomas Rabaix <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sonata\AdminBundle\Tests\App\Controller; | ||
|
||
use Sonata\AdminBundle\Controller\CRUDController; | ||
use Sonata\AdminBundle\Exception\ModelManagerThrowable; | ||
|
||
/** | ||
* @phpstan-extends CRUDController<object> | ||
*/ | ||
final class CustomModelManagerThrowableMessageController extends CRUDController | ||
{ | ||
public const ERROR_MESSAGE = 'message from model manager throwable'; | ||
|
||
protected function handleModelManagerThrowable(ModelManagerThrowable $exception): string | ||
{ | ||
return self::ERROR_MESSAGE; | ||
} | ||
} |
Oops, something went wrong.