File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed
Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ public function getHydratorConfig()
5454 return [
5555 'invokables ' => [
5656 'Zoho\Subscriptions\Hydrator\Customer ' => 'Zoho\Subscriptions\Hydrator\CustomerHydrator ' ,
57+ 'Zoho\Subscriptions\Hydrator\Subscription ' => 'Zoho\Subscriptions\Hydrator\SubscriptionHydrator ' ,
5758 ]
5859 ];
5960 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Zoho \Subscriptions \Hydrator ;
4+
5+ use Zend \Stdlib \Hydrator \ClassMethods as ClassMethodsHydrator ;
6+ use Zoho \Subscriptions \Hydrator \Strategy \DateTimeFormatterStrategy ;
7+
8+ class SubscriptionHydrator extends ClassMethodsHydrator
9+ {
10+ public function __construct ()
11+ {
12+ parent ::__construct ();
13+
14+ error_log ('test ' );
15+
16+ $ datetimeStrategy = new DateTimeFormatterStrategy (\DateTime::ISO8601 );
17+ $ this ->addStrategy ('created_time ' , $ datetimeStrategy );
18+ $ this ->addStrategy ('updated_time ' , $ datetimeStrategy );
19+ }
20+ }
Original file line number Diff line number Diff line change @@ -262,7 +262,15 @@ public function fetchAll($options = [])
262262 $ result = $ this ->request ($ url );
263263
264264 $ collectionName = $ this ->getCollectionName ();
265- return $ result [$ collectionName ];
265+ $ collection = $ result [$ collectionName ];
266+ $ entityClass = $ this ->getEntityClass ();
267+ $ resultList = [];
268+
269+ foreach ($ collection as $ member ) {
270+ $ resultList [] = $ this ->getHydrator ()->hydrate ($ member , new $ entityClass ());
271+ }
272+
273+ return $ resultList ;
266274 }
267275
268276 /**
You can’t perform that action at this time.
0 commit comments