Commit 40396500 authored by Ludwig Ruderstaller's avatar Ludwig Ruderstaller
Browse files

Merge branch 'develop' into 'master'

Develop

See merge request !5
parents 7b709ebb 98aa553a
Pipeline #19600 failed with stage
in 1 minute and 32 seconds
...@@ -14,6 +14,7 @@ declare(strict_types=1); ...@@ -14,6 +14,7 @@ declare(strict_types=1);
namespace Cwd\PowerDNSClient; namespace Cwd\PowerDNSClient;
use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\Reader;
use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Request;
use Http\Discovery\HttpClientDiscovery; use Http\Discovery\HttpClientDiscovery;
use Symfony\Component\PropertyAccess\PropertyAccessor; use Symfony\Component\PropertyAccess\PropertyAccessor;
...@@ -42,7 +43,7 @@ class Client ...@@ -42,7 +43,7 @@ class Client
/** @var Serializer */ /** @var Serializer */
private $serializer; private $serializer;
public function __construct($apiHost, $apiKey, ?GuzzleClient $client = null) public function __construct($apiHost, $apiKey, ?GuzzleClient $client = null, Reader $annotationReader)
{ {
$this->apiKey = $apiKey; $this->apiKey = $apiKey;
$this->apiUri = sprintf('%s/%s', $apiHost, $this->basePath); $this->apiUri = sprintf('%s/%s', $apiHost, $this->basePath);
...@@ -51,7 +52,7 @@ class Client ...@@ -51,7 +52,7 @@ class Client
$this->client = HttpClientDiscovery::find(); $this->client = HttpClientDiscovery::find();
} }
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader($annotationReader));
$discriminator = new ClassDiscriminatorFromClassMetadata($classMetadataFactory); $discriminator = new ClassDiscriminatorFromClassMetadata($classMetadataFactory);
$normalizer = new ObjectNormalizer($classMetadataFactory, new CamelCaseToSnakeCaseNameConverter(), new PropertyAccessor(), new ReflectionExtractor(), $discriminator); $normalizer = new ObjectNormalizer($classMetadataFactory, new CamelCaseToSnakeCaseNameConverter(), new PropertyAccessor(), new ReflectionExtractor(), $discriminator);
......
...@@ -12,11 +12,13 @@ declare(strict_types=1); ...@@ -12,11 +12,13 @@ declare(strict_types=1);
namespace Cwd\PowerDNSClient; namespace Cwd\PowerDNSClient;
use Doctrine\Common\Annotations\Reader;
class PowerDNSClientFactory class PowerDNSClientFactory
{ {
static public function createClient(string $uri, string $apiKey, ?string $defaultServer = null): PowerDNSClient static public function createClient(string $uri, string $apiKey, ?string $defaultServer = null, Reader $reader): PowerDNSClient
{ {
$client = new Client($uri, $apiKey); $client = new Client($uri, $apiKey, null, $reader);
$pdns = new PowerDNSClient($client); $pdns = new PowerDNSClient($client);
if ($defaultServer !== null) { if ($defaultServer !== null) {
$pdns->setDefaultServerId($defaultServer); $pdns->setDefaultServerId($defaultServer);
......
...@@ -7,4 +7,5 @@ services: ...@@ -7,4 +7,5 @@ services:
arguments: arguments:
- '%cwd_power_dns_client.uri%' - '%cwd_power_dns_client.uri%'
- '%cwd_power_dns_client.api_key%' - '%cwd_power_dns_client.api_key%'
- '%cwd_power_dns_client.default_server%' - '%cwd_power_dns_client.default_server%'
\ No newline at end of file - '@annotation_reader'
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment