-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(serializer):
VersionMap
attribute to add version for `Serializ…
…able`.
- Loading branch information
1 parent
cafa2eb
commit 5a22197
Showing
2 changed files
with
44 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace LastDragon_ru\LaraASP\Serializer\Attributes; | ||
|
||
use Attribute; | ||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap; | ||
|
||
#[Attribute(Attribute::TARGET_CLASS)] | ||
class VersionMap extends DiscriminatorMap { | ||
/** | ||
* @param array<string, class-string> $mapping | ||
*/ | ||
public function __construct(array $mapping) { | ||
parent::__construct('$v', $mapping); | ||
} | ||
} |
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