Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feature #19371 [Serializer] Give access to the context to support* me…
…thods (dunglas) This PR was squashed before being merged into the 3.3-dev branch (closes #19371). Discussion ---------- [Serializer] Give access to the context to support* methods | Q | A | | --- | --- | | Branch? | master | | Bug fix? | no (?) | | New feature? | yes | | BC breaks? | no | | Deprecations? | no | | Tests pass? | yes | | Fixed tickets | - | | License | MIT | | Doc PR | n/a | This is a current use case to want to access the context form the `supports*` methods. This PR fixes this limitation. Maybe can it be considered a bug fix? Commits ------- 6a7a16e [Serializer] Give access to the context to support* methods
- Loading branch information
Showing
10 changed files
with
226 additions
and
48 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
27 changes: 27 additions & 0 deletions
27
src/Symfony/Component/Serializer/Encoder/ContextAwareDecoderInterface.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,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Serializer\Encoder; | ||
|
||
/** | ||
* Adds the support of an extra $context parameter for the supportsDecoding method. | ||
* | ||
* @author Kévin Dunglas <dunglas@gmail.com> | ||
*/ | ||
interface ContextAwareDecoderInterface extends DecoderInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
* | ||
* @param array $context options that decoders have access to | ||
*/ | ||
public function supportsDecoding($format, array $context = array()); | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Symfony/Component/Serializer/Encoder/ContextAwareEncoderInterface.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,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Serializer\Encoder; | ||
|
||
/** | ||
* Adds the support of an extra $context parameter for the supportsEncoding method. | ||
* | ||
* @author Kévin Dunglas <dunglas@gmail.com> | ||
*/ | ||
interface ContextAwareEncoderInterface extends EncoderInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
* | ||
* @param array $context options that encoders have access to | ||
*/ | ||
public function supportsEncoding($format, array $context = array()); | ||
} |
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
27 changes: 27 additions & 0 deletions
27
src/Symfony/Component/Serializer/Normalizer/ContextAwareDenormalizerInterface.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,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Serializer\Normalizer; | ||
|
||
/** | ||
* Adds the support of an extra $context parameter for the supportsDenormalization method. | ||
* | ||
* @author Kévin Dunglas <dunglas@gmail.com> | ||
*/ | ||
interface ContextAwareDenormalizerInterface extends DenormalizerInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
* | ||
* @param array $context options that denormalizers have access to | ||
*/ | ||
public function supportsDenormalization($data, $type, $format = null, array $context = array()); | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Symfony/Component/Serializer/Normalizer/ContextAwareNormalizerInterface.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,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Serializer\Normalizer; | ||
|
||
/** | ||
* Adds the support of an extra $context parameter for the supportsNormalization method. | ||
* | ||
* @author Kévin Dunglas <dunglas@gmail.com> | ||
*/ | ||
interface ContextAwareNormalizerInterface extends NormalizerInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
* | ||
* @param array $context options that normalizers have access to | ||
*/ | ||
public function supportsNormalization($data, $format = null, array $context = array()); | ||
} |
Oops, something went wrong.