-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IBX-8190: Add Symfony's Serializer support #121
Open
barw4
wants to merge
96
commits into
main
Choose a base branch
from
serializer-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 82 commits
Commits
Show all changes
96 commits
Select commit
Hold shift + click to select a range
cb4e61d
Add Symfony's Serializer support
barw4 5bf3e43
Add `AdapterNormalizer`
barw4 b478bae
Remove `ValueObjectVisitorDispatcher`
barw4 8e1ddf2
Rollback
barw4 1faaf7d
Rollback
barw4 d59508e
Rollback
barw4 2e731e3
Fixup
barw4 b56999e
Applied review remarks
barw4 a6cb018
Code cleanup
barw4 6bc9690
Code cleanup
barw4 97dc64b
Code cleanup
barw4 9659e6a
Fixup
barw4 8697942
Change login code to 200
barw4 d182d85
Set proper encoding format
barw4 ae726ac
Handle XML
barw4 be01db6
Rollback
barw4 a373e56
Rollback
barw4 f3b23cc
Use dispatched visitor instead of creating a new one
barw4 a515652
Reuse already initialized visitor
barw4 20b0b1e
Fixup
barw4 ed2f886
Fix PHPStan issues
barw4 3d01d41
Fixups
barw4 847a54d
Fixups
barw4 5cf488f
Make unit tests use the new XML generator
barw4 89572a8
Rollback
barw4 7a6e45c
Stan
barw4 3b6da3a
Made `transformData` method private
Steveb-p 176ea72
Introduced normalizers for Generator state
Steveb-p 7c5c50a
Introduced normalizers for Generator state
Steveb-p 81e18ea
Introduced normalizers for Generator state
Steveb-p 6e5d5b4
Introduced normalizers for Generator state
Steveb-p 0babd33
Introduced normalizers for Generator state
Steveb-p 26fd4bb
Introduced normalizers for Generator state
Steveb-p 264eb4f
Introduced normalizers for Generator state
Steveb-p a78bb4b
Introduced normalizers for Generator state
Steveb-p 4a63396
Add Symfony's Serializer support
barw4 179d53e
Add `AdapterNormalizer`
barw4 5bd9f48
Remove `ValueObjectVisitorDispatcher`
barw4 0f4433d
Rollback
barw4 8c35ac3
Rollback
barw4 a8ab8f6
Rollback
barw4 07d16a9
Fixup
barw4 5ba013a
Applied review remarks
barw4 9b751b8
Code cleanup
barw4 2bf13b9
Code cleanup
barw4 23aea91
Code cleanup
barw4 4d82929
Fixup
barw4 3e2ed35
Change login code to 200
barw4 cca8fa2
Set proper encoding format
barw4 d4741e1
Handle XML
barw4 b918595
Rollback
barw4 5b34e35
Rollback
barw4 f7edd5a
Use dispatched visitor instead of creating a new one
barw4 5a60415
Reuse already initialized visitor
barw4 0404793
Fixup
barw4 effe8d8
Fix PHPStan issues
barw4 12d2a5c
Fixups
barw4 4f23fca
Fixups
barw4 737877a
Make unit tests use the new XML generator
barw4 8b57228
Rollback
barw4 b12d06d
Made `transformData` method private
Steveb-p ea56426
Introduced normalizers for Generator state
Steveb-p be241a3
Introduced normalizers for Generator state
Steveb-p a934afd
Introduced normalizers for Generator state
Steveb-p 6b77b59
Introduced normalizers for Generator state
Steveb-p 91976bf
Introduced normalizers for Generator state
Steveb-p 64aeee9
Introduced normalizers for Generator state
Steveb-p b5e74ab
Introduced normalizers for Generator state
Steveb-p bb2b396
Introduced normalizers for Generator state
Steveb-p 1243dd6
Update Generator normalizers
barw4 f67ee78
Generate baseline
barw4 730868f
Refactor encoder context
barw4 b08f735
Handle empty `ArrayList` object
barw4 d781e88
`outer_element` context item
barw4 d7db4db
Remove dependencies to old Xml generator
barw4 b59b5bc
Merge remote-tracking branch 'origin/serializer-support' into seriali…
barw4 e16ec64
Remove old Xml generator
barw4 e692018
Merge branch 'main' into serializer-support
barw4 46032c9
CS
barw4 31fcff8
Merge remote-tracking branch 'origin/serializer-support' into seriali…
barw4 6330b60
Update services.yml
barw4 9d014ce
Rollback
barw4 3318577
Implement integration tests
barw4 8f232cf
Fixup
barw4 b567473
CS
barw4 bee695f
Fixup
barw4 cc840b3
Fix tests
barw4 66deeb9
Fixup
barw4 d8e19c1
Cleanup generators
barw4 32801e9
PHPStan
barw4 d608d6a
CS
barw4 c13ec95
Remove comment
barw4 32ca57e
Clean up field generators
barw4 8db052a
PHPStan
barw4 c0a09bf
Applied review remarks
barw4 44bcf9e
Applied review remark
barw4 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Contracts\Rest\Output; | ||
|
||
final class ValueObjectVisitorResolver implements ValueObjectVisitorResolverInterface | ||
{ | ||
/** @var array<class-string, ValueObjectVisitor> */ | ||
private array $visitors; | ||
|
||
/** | ||
* @param class-string $visitedClassName | ||
*/ | ||
public function addVisitor(string $visitedClassName, ValueObjectVisitor $visitor): void | ||
{ | ||
$this->visitors[$visitedClassName] = $visitor; | ||
} | ||
|
||
public function resolveValueObjectVisitor(object $object): ?ValueObjectVisitor | ||
{ | ||
$className = $object::class; | ||
|
||
do { | ||
if (isset($this->visitors[$className])) { | ||
return $this->visitors[$className]; | ||
} | ||
} while ($className = get_parent_class($className)); | ||
|
||
return null; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/contracts/Output/ValueObjectVisitorResolverInterface.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,14 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Contracts\Rest\Output; | ||
|
||
interface ValueObjectVisitorResolverInterface | ||
{ | ||
public function resolveValueObjectVisitor(object $object): ?ValueObjectVisitor; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I don't understand this exception. What state and how does this relate to
getData
method?