Added doctrine collection into toArray method.