Skip to content
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

Add ArrayConverter #81

Closed

Conversation

nsd0mnawabee
Copy link

No description provided.

@jdreesen
Copy link
Member

Could you please elaborate on why we need this and how it is used?

@jdreesen jdreesen changed the title add ArrayConverter Add ArrayConverter Aug 20, 2024
@mike4git
Copy link
Collaborator

He had the situation where a Populator needed a way to convert an array of objects and assign it to a certain target property.
But therefore he could have written:

class MyPopulator implements Populator 
{
   ...
   public function populate(object $target, object $source, object|null $ctx): void
   {
      ...
      $parts = $source->getParts();
      $target->targetParts = $this->partConverter->convert(new ArrayObject($parts), $ctx);
   }
}

And then there is no need for an ArrayConverter.

So, PR can be closed afaik.

@mike4git mike4git closed this Aug 20, 2024
@mike4git
Copy link
Collaborator

Alternative solution has been found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants