-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Messenger] DoctrineEnvelopeEntityReference custom exception flow
- Loading branch information
Showing
5 changed files
with
129 additions
and
78 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
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
38 changes: 38 additions & 0 deletions
38
packages/messenger/DoctrineEnvelopeEntityReference/Exception/ObjectNotFoundException.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,38 @@ | ||
<?php | ||
|
||
namespace Draw\Component\Messenger\DoctrineEnvelopeEntityReference\Exception; | ||
|
||
use Draw\Component\Messenger\DoctrineEnvelopeEntityReference\Stamp\PropertyReferenceStamp; | ||
use Symfony\Component\Messenger\Exception\UnrecoverableExceptionInterface; | ||
|
||
class ObjectNotFoundException extends \Exception implements UnrecoverableExceptionInterface | ||
{ | ||
public function __construct( | ||
private string $objectClass, | ||
private ?PropertyReferenceStamp $propertyReferenceStamp = null, | ||
) { | ||
$message = \sprintf( | ||
'Object of class [%s] not found.', | ||
$objectClass, | ||
); | ||
|
||
if ($propertyReferenceStamp) { | ||
$message .= \sprintf( | ||
' Identifiers [%s]', | ||
json_encode($propertyReferenceStamp->getIdentifiers()) | ||
); | ||
} | ||
|
||
parent::__construct($message); | ||
} | ||
|
||
public function getObjectClass(): string | ||
{ | ||
return $this->objectClass; | ||
} | ||
|
||
public function getPropertyReferenceStamp(): ?PropertyReferenceStamp | ||
{ | ||
return $this->propertyReferenceStamp; | ||
} | ||
} |
47 changes: 0 additions & 47 deletions
47
...s/DoctrineEnvelopeEntityReference/EventListener/PropertyReferenceEncodingListenerTest.php
This file was deleted.
Oops, something went wrong.
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