-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[ObjectMapper] embed collection transformer #60442
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
base: 7.3
Are you sure you want to change the base?
Conversation
use Symfony\Component\ObjectMapper\Tests\Fixtures\TransformCollection\A as TransformCollectionA; | ||
use Symfony\Component\ObjectMapper\Tests\Fixtures\TransformCollection\B as TransformCollectionB; | ||
use Symfony\Component\ObjectMapper\Tests\Fixtures\TransformCollection\C as TransformCollectionC; | ||
use Symfony\Component\ObjectMapper\Tests\Fixtures\TransformCollection\D as TransformCollectionD; |
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.
I would make the classe names longer instead of using an alias. It's simpler to call the class by its name.
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.
its nitpicking as these are test fixtures I don't see the benefits
src/Symfony/Component/ObjectMapper/Tests/Fixtures/TransformCollection/A.php
Show resolved
Hide resolved
Co-authored-by: Jérôme Tamarelle <jerome@tamarelle.net>
*/ | ||
class MapCollection implements TransformCallableInterface | ||
{ | ||
public function __construct(private ?ObjectMapperInterface $objectMapper = new ObjectMapper()) |
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.
public function __construct(private ?ObjectMapperInterface $objectMapper = new ObjectMapper()) | |
public function __construct(private ObjectMapperInterface $objectMapper = new ObjectMapper()) |
this can be removed then. Sorry, I forgot in my suggestion
This is another approach to embeded collection mapping that avoids changing the ObjectMapper. Even if this doesn't land in the component it'd be a good thing to document. Let me know your thoughts.