55namespace Drupal \helfi_kymp_content ;
66
77use Drupal \Component \Datetime \TimeInterface ;
8- use Drupal \Core \Site \ Settings ;
8+ use Drupal \Core \Config \ ConfigFactoryInterface ;
99use Drupal \Core \TypedData \Exception \MissingDataException ;
1010use Drupal \Core \TypedData \TypedDataManagerInterface ;
1111use Drupal \Core \Utility \Error ;
@@ -49,7 +49,7 @@ public function __construct(
4949 protected ClientInterface $ client ,
5050 protected TypedDataManagerInterface $ typedDataManager ,
5151 protected TimeInterface $ time ,
52- protected Settings $ settings ,
52+ protected ConfigFactoryInterface $ configFactory ,
5353 protected PaikkatietoClient $ paikkatietoClient ,
5454 ) {
5555 // EPSG:3879 is Helsinki local CRS (ETRS-GK25FIN).
@@ -136,20 +136,20 @@ public function fetchNearbyStreets(array $items): void {
136136 * @throws \InvalidArgumentException
137137 */
138138 protected function fetchFromApi (): array {
139- $ settings = $ this ->settings ->get ('helfi_kymp_mobilenote ' , [] );
139+ $ settings = $ this ->configFactory ->get ('helfi_kymp_content.settings ' );
140140
141141 if (
142- empty ($ settings[ 'wfs_url ' ] ) ||
143- empty ($ settings[ 'wfs_username ' ] ) ||
144- empty ($ settings[ 'wfs_password ' ] )
142+ empty ($ settings-> get ( 'wfs_url ' ) ) ||
143+ empty ($ settings-> get ( 'wfs_username ' ) ) ||
144+ empty ($ settings-> get ( 'wfs_password ' ) )
145145 ) {
146146 throw new \InvalidArgumentException ('MobileNote: Missing API credentials. ' );
147147 }
148148
149149 try {
150150 $ minDate = (new \DateTime ())
151151 ->setTimestamp ($ this ->time ->getRequestTime ())
152- ->modify ($ settings[ 'sync_lookback_offset ' ] ?? '-30 days ' );
152+ ->modify ($ settings-> get ( 'sync_lookback_offset ' ) ?? '-30 days ' );
153153 }
154154 catch (\DateMalformedStringException $ e ) {
155155 throw new \InvalidArgumentException ($ e ->getMessage (), previous: $ e );
@@ -166,16 +166,16 @@ protected function fetchFromApi(): array {
166166</Filter>
167167XML ;
168168
169- $ response = $ this ->client ->request ('GET ' , $ settings[ 'wfs_url ' ] , [
170- 'auth ' => [$ settings[ 'wfs_username ' ] , $ settings[ 'wfs_password ' ] ],
169+ $ response = $ this ->client ->request ('GET ' , $ settings-> get ( 'wfs_url ' ) , [
170+ 'auth ' => [$ settings-> get ( 'wfs_username ' ) , $ settings-> get ( 'wfs_password ' ) ],
171171 'query ' => [
172172 'service ' => 'WFS ' ,
173173 'version ' => '1.1.0 ' ,
174174 'request ' => 'GetFeature ' ,
175175 'typeName ' => 'ppoytakirjaExtranet ' ,
176176 'outputFormat ' => 'application/json ' ,
177177 'srsName ' => 'EPSG:3879 ' ,
178- 'maxFeatures ' => 1000 ,
178+ 'maxFeatures ' => 10000 ,
179179 'filter ' => preg_replace ('/\s+/ ' , ' ' , trim ($ filterXml )),
180180 ],
181181 'timeout ' => 30 ,
0 commit comments