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);
namespace Cwd\PowerDNSClient;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\Reader;
use GuzzleHttp\Psr7\Request;
use Http\Discovery\HttpClientDiscovery;
use Symfony\Component\PropertyAccess\PropertyAccessor;
......@@ -42,7 +43,7 @@ class Client
/** @var 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->apiUri = sprintf('%s/%s', $apiHost, $this->basePath);
......@@ -51,7 +52,7 @@ class Client
$this->client = HttpClientDiscovery::find();
}
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader($annotationReader));
$discriminator = new ClassDiscriminatorFromClassMetadata($classMetadataFactory);
$normalizer = new ObjectNormalizer($classMetadataFactory, new CamelCaseToSnakeCaseNameConverter(), new PropertyAccessor(), new ReflectionExtractor(), $discriminator);
......
......@@ -12,11 +12,13 @@ declare(strict_types=1);
namespace Cwd\PowerDNSClient;
use Doctrine\Common\Annotations\Reader;
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);
if ($defaultServer !== null) {
$pdns->setDefaultServerId($defaultServer);
......
......@@ -7,4 +7,5 @@ services:
arguments:
- '%cwd_power_dns_client.uri%'
- '%cwd_power_dns_client.api_key%'
- '%cwd_power_dns_client.default_server%'
\ No newline at end of file
- '%cwd_power_dns_client.default_server%'
- '@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