@@ -96,22 +96,6 @@ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $
9696 $ zohoConfig = $ config ['zoho ' ];
9797 $ resourceConfig = $ config ['zoho ' ]['resources ' ][$ requestedName ];
9898
99- /*$opensslCapath = ini_get('openssl.capath');
100-
101- if (!empty($opensslCapath)) {
102- $clientConfig = ['sslcapath' => $opensslCapath];
103- } else {
104- $clientConfig = ['sslcapath' => $zohoConfig['ssl_config']['sslcapath']];
105- }
106-
107- $httpClient = new Client(null, $clientConfig);
108- $httpClient->setHeaders(array(
109- 'Content-Type' => 'application/json;charset=UTF-8',
110- 'X-com-zoho-subscriptions-organizationid' => $zohoConfig['organization_id'],
111- 'Authorization' => 'Zoho-authtoken ' . $zohoConfig['auth_token'],
112- ));
113-
114- $resource = new Resource($httpClient);*/
11599 $ curl = curl_init ();
116100 curl_setopt ($ curl , CURLOPT_RETURNTRANSFER , true );
117101 curl_setopt ($ curl , CURLOPT_HTTPHEADER , [
@@ -130,14 +114,14 @@ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $
130114 $ inputFilter = $ inputFilterFactory ->createInputFilter ($ resourceConfig ['input-filter ' ]);
131115 $ resource ->setInputFilter ($ inputFilter );
132116
133- $ hydrator = new ClassMethods (true );
117+ $ hydratorManager = $ serviceLocator ->get ('HydratorManager ' );
118+
119+ $ hydratorName = str_replace ('Entity ' , 'Hydrator ' , $ entityClass );
134120
135- if (isset ($ resourceConfig ['strategies ' ]) && is_array ($ resourceConfig ['strategies ' ])) {
136- foreach ($ resourceConfig ['strategies ' ] as $ field => $ strategy ) {
137- if ($ serviceLocator ->has ($ strategy )) {
138- $ hydrator ->addStrategy ($ field , $ serviceLocator ->get ($ strategy ));
139- }
140- }
121+ if ($ hydratorManager ->hast ($ hydratorName )) {
122+ $ hydrator = $ hydratorManager ->get ($ hydratorName );
123+ } else {
124+ $ hydrator = new ClassMethods ();
141125 }
142126
143127 $ resource ->setHydrator ($ hydrator );
0 commit comments