Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"require": {
"php": "^8.1",
"ext-soap": "*",
"scn/evalanche-soap-api-struct": "^2.5",
"scn/evalanche-soap-api-struct": "^2.6",
"scn/hydrator": "^2|^3",
"scn/hydrator-property-values": "^2.0|^3.0"
},
Expand Down
269 changes: 179 additions & 90 deletions composer.lock

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions src/Client/LeadPage/LeadpageClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,60 @@ public function setContentContainerData(int $leadpageId, HashMapInterface $hashM
$this->hydratorConfigFactory->createResourceInformationConfig()
);
}

/** @inheritdoc */
public function removeAllArticles(int $id): bool
{
return $this->responseMapper->getBoolean(
$this->soapClient->removeAllArticles([
'leadpage_id' => $id
]),
'removeAllArticlesResult'
);
}

/** @inheritdoc */
public function removeArticles(int $id, array $referenceIds): array
{
return $this->responseMapper->getObjects(
$this->soapClient->removeArticles(
[
'leadpage_id' => $id,
'reference_ids' => $referenceIds,
]
),
'removeArticlesResult',
$this->hydratorConfigFactory->createLeadpageArticleConfig()
);
}

/** @inheritdoc */
public function getArticlesByLeadpageId(int $id): array
{
return $this->responseMapper->getObjects(
$this->soapClient->getArticles([
'leadpage_id' => $id
]),
'getArticlesResult',
$this->hydratorConfigFactory->createLeadpageArticleConfig()
);
}

/** @inheritdoc */
public function addArticles(int $id, array $articles): array
{
return $this->responseMapper->getObjects(
$this->soapClient->addArticles(
[
'leadpage_id' => $id,
'articles' => $this->extractor->extractArray(
$this->hydratorConfigFactory->createLeadpageArticleConfig(),
$articles
)
]
),
'addArticlesResult',
$this->hydratorConfigFactory->createLeadpageArticleConfig()
);
}
}
45 changes: 45 additions & 0 deletions src/Client/LeadPage/LeadpageClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Scn\EvalancheSoapApiConnector\Exception\EmptyResultException;
use Scn\EvalancheSoapStruct\Struct\Generic\HashMapInterface;
use Scn\EvalancheSoapStruct\Struct\Generic\ResourceInformationInterface;
use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageArticleInterface;
use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageConfigurationInterface;

interface LeadpageClientInterface extends
Expand Down Expand Up @@ -69,4 +70,48 @@ public function getContentContainerData(int $leadpageId): HashMapInterface;
* @throws EmptyResultException
*/
public function setContentContainerData(int $leadpageId, HashMapInterface $hashMap): ResourceInformationInterface;

/**
* Remove all articles from the leadpage
*
* @param int $id
*
* @return bool
*
* @throws EmptyResultException
*/
public function removeAllArticles(int $id): bool;

/**
* Remove certain articles from the leadpage
*
* @param int $id
* @param int[] $referenceIds
*
* @return LeadpageArticleInterface[]
*
* @throws EmptyResultException
*/
public function removeArticles(int $id, array $referenceIds): array;

/**
* Retrieve all articles of the leadpage
*
* @param int $id
*
* @return LeadpageArticleInterface[]
* @throws EmptyResultException
*/
public function getArticlesByLeadpageId(int $id): array;

/**
* Add articles to a leadpage
*
* @param int $id
* @param array $articles
*
* @return LeadpageArticleInterface[]
* @throws EmptyResultException
*/
public function addArticles(int $id, array $articles): array;
}
56 changes: 56 additions & 0 deletions src/Client/LeadPageTemplate/LeadpageTemplateClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,60 @@ public function setConfiguration(
$this->hydratorConfigFactory->createLeadpageTemplateConfigurationConfig(),
);
}

/** @inheritdoc */
public function removeAllArticles(int $id): bool
{
return $this->responseMapper->getBoolean(
$this->soapClient->removeAllArticles([
'leadpage_template_id' => $id
]),
'removeAllArticlesResult'
);
}

/** @inheritdoc */
public function removeArticles(int $id, array $referenceIds): array
{
return $this->responseMapper->getObjects(
$this->soapClient->removeArticles(
[
'leadpage_template_id' => $id,
'reference_ids' => $referenceIds,
]
),
'removeArticlesResult',
$this->hydratorConfigFactory->createLeadpageArticleConfig()
);
}

/** @inheritdoc */
public function getArticlesByLeadpageTemplateId(int $id): array
{
return $this->responseMapper->getObjects(
$this->soapClient->getArticles([
'leadpage_template_id' => $id
]),
'getArticlesResult',
$this->hydratorConfigFactory->createLeadpageArticleConfig()
);
}

/** @inheritdoc */
public function addArticles(int $id, array $articles): array
{
return $this->responseMapper->getObjects(
$this->soapClient->addArticles(
[
'leadpage_template_id' => $id,
'articles' => $this->extractor->extractArray(
$this->hydratorConfigFactory->createLeadpageArticleConfig(),
$articles
)
]
),
'addArticlesResult',
$this->hydratorConfigFactory->createLeadpageArticleConfig()
);
}
}
45 changes: 45 additions & 0 deletions src/Client/LeadPageTemplate/LeadpageTemplateClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Scn\EvalancheSoapApiConnector\Client\Generic\ResourceTraitInterface;
use Scn\EvalancheSoapApiConnector\Exception\EmptyResultException;
use Scn\EvalancheSoapStruct\Struct\Generic\ResourceInformationInterface;
use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageArticleInterface;
use Scn\EvalancheSoapStruct\Struct\LeadPageTemplate\LeadpageTemplateConfigurationInterface;
use Scn\EvalancheSoapStruct\Struct\LeadPageTemplate\TemplatesSourcesInterface;

Expand Down Expand Up @@ -63,4 +64,48 @@ public function setConfiguration(
int $id,
LeadpageTemplateConfigurationInterface $configuration
): LeadpageTemplateConfigurationInterface;

/**
* Remove all articles from the leadpage-template
*
* @param int $id
*
* @return bool
*
* @throws EmptyResultException
*/
public function removeAllArticles(int $id): bool;

/**
* Remove certain articles from the leadpage-template
*
* @param int $id
* @param int[] $referenceIds
*
* @return LeadpageArticleInterface[]
*
* @throws EmptyResultException
*/
public function removeArticles(int $id, array $referenceIds): array;

/**
* Retrieve all articles of the leadpage-template
*
* @param int $id
*
* @return LeadpageArticleInterface[]
* @throws EmptyResultException
*/
public function getArticlesByLeadpageTemplateId(int $id): array;

/**
* Add articles to a leadpage-template
*
* @param int $id
* @param array $articles
*
* @return LeadpageArticleInterface[]
* @throws EmptyResultException
*/
public function addArticles(int $id, array $articles): array;
}
6 changes: 6 additions & 0 deletions src/Hydrator/Config/HydratorConfigFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Scn\EvalancheSoapApiConnector\Hydrator\Config\Generic\ResourceInformationConfig;
use Scn\EvalancheSoapApiConnector\Hydrator\Config\Generic\ResourceTypeInformationConfig;
use Scn\EvalancheSoapApiConnector\Hydrator\Config\Generic\ServiceStatusConfig;
use Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadPage\LeadpageArticleConfig;
use Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadPage\LeadpageConfigurationConfig;
use Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadPageTemplate\LeadpageTemplateSourcesConfig;
use Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadPageTemplate\LeadpageTemplateConfigurationConfig;
Expand Down Expand Up @@ -238,6 +239,11 @@ public function createMailingArticleConfig(): HydratorConfigInterface
return new MailingArticleConfig();
}

public function createLeadpageArticleConfig(): HydratorConfigInterface
{
return new LeadpageArticleConfig();
}

public function createMailingDetailConfig(): HydratorConfigInterface
{
return new MailingDetailConfig();
Expand Down
2 changes: 2 additions & 0 deletions src/Hydrator/Config/HydratorConfigFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public function createMassUpdateResultConfig(): HydratorConfigInterface;

public function createMailingArticleConfig(): HydratorConfigInterface;

public function createLeadpageArticleConfig(): HydratorConfigInterface;

public function createMailingDetailConfig(): HydratorConfigInterface;

public function createMailingClickConfig(): HydratorConfigInterface;
Expand Down
56 changes: 56 additions & 0 deletions src/Hydrator/Config/LeadPage/LeadpageArticleConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadPage;

use Scn\EvalancheSoapApiConnector\Hydrator\Config\HydratorConfigInterface;
use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageArticle;
use Scn\EvalancheSoapStruct\Struct\StructInterface;
use Scn\HydratorPropertyValues\Property\IntegerValue;

/**
* Class LeadpageArticleConfig
*
* @package Scn\EvalancheSoapApiConnector\Hydrator\Leadpage
*/
class LeadpageArticleConfig implements HydratorConfigInterface
{
/**
* @return StructInterface
*/
public function getObject(): StructInterface
{
return new LeadpageArticle();
}

/**
* @return array
*/
public function getHydratorProperties(): array
{
return [
'id' => IntegerValue::set('id'),
'article_id' => IntegerValue::set('articleId'),
'targetgroup_id' => IntegerValue::set('targetGroupId'),
'landingpage_preset_id' => IntegerValue::set('landingpagePresetId'),
'mobile_preset_id' => IntegerValue::set('mobilePresetId'),
'sort_pos' => IntegerValue::set('sortPos'),
'slot' => IntegerValue::set('slot'),
];
}

/**
* @return array
*/
public function getExtractorProperties(): array
{
return [
'id' => IntegerValue::get('id'),
'article_id' => IntegerValue::get('articleId'),
'targetgroup_id' => IntegerValue::get('targetGroupId'),
'landingpage_preset_id' => IntegerValue::get('landingpagePresetId'),
'mobile_preset_id' => IntegerValue::get('mobilePresetId'),
'sort_pos' => IntegerValue::get('sortPos'),
'slot' => IntegerValue::get('slot'),
];
}
}
Loading