schmittjoh/serializer — pull request #87 by HarmenM (2013-05-01 09:06:21+00:00)
Title: Moved the collectionTypes of the ArrayCollectionHandler to a protected static property to enable extensibility

This pull request enables the possibility to extend the *ArrayCollectionHandler* in a more convenient way. For a project I'm working on, I have a custom resultset collection, which extends the default Doctrine collection. When serializing this collection, it is not possible to use the *ArrayCollectionHandler* provided in the JMS Serializer, because the default collection handler has (of course) no knowledge of the existence of my custom collection.

In this pull request, the collection types array is moved to a static property, in order to make this handler easier to extend. When this class is extended, other collection types can be added without the necessity of duplicating the *getSubscribingMethods* method.

This makes it possible to make use of the *getSubscribingMethods* method, while having custom collection classes added to it:

```PHP
class CustomArrayCollectionHandler extends\JMS\Serializer\Handler\ArrayCollectionHandler
{
protected static $collectionTypes = array('CustomCollection1', '...');
}
```