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

custom collection handler #415

Closed
romankonz opened this issue Mar 17, 2015 · 2 comments
Closed

custom collection handler #415

romankonz opened this issue Mar 17, 2015 · 2 comments

Comments

@romankonz
Copy link

Hi,

i like to use a class that extends the doctrine array collection as collection type.
I copied the code of the ArrayCollectionHandler and changed only 2 things:

// my collection class
class MyCollection extends ArrayCollection
{
    // custom code here
}

class CustomCollectionHandler
{
     // ...
    public static function getSubscribingMethods()
    {
        // ...
        $collectionTypes = [MyCollection::class];
        // ...
    }
    // ...
     public function deserializeCollection(VisitorInterface $visitor, $data, array $type, Context $context)
     {
        $collectionType = $type['name'];
        // ...
        return new $collectionType($visitor->visitArray($data, $type, $context));
    }
}

Now i can register my own collection classes with this handler.
Maybe it would be useful to add something like this as a generic configurable solution?

@Oppodelldog
Copy link

+1

@goetas
Copy link
Collaborator

goetas commented Aug 3, 2016

this can be already implemented in userland

@goetas goetas closed this as completed Aug 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants