Skip to content

Commit

Permalink
Cleanup and simplify objectType configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Fedurtsya <[email protected]>
  • Loading branch information
Sieg committed Dec 31, 2023
1 parent 89b498f commit abe5ca3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 32 deletions.
14 changes: 13 additions & 1 deletion src/ChangeFilter/Category/services.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
parameters:
sitemap.object_type.category: 'category'

services:

_defaults:
Expand All @@ -6,7 +9,7 @@ services:

FreshAdvance\Sitemap\ChangeFilter\Category\CategoryChangeFilter:
arguments:
$pageTypeConfiguration: '@FreshAdvance\Sitemap\Url\DataTypeFactory\CategoryUrlType'
$objectType: '%sitemap.object_type.category%'
$modelItemRepository: '@FreshAdvance\Sitemap\ChangeFilter\Category\CategoryChangeFilterItemRepository'
tags:
- 'sitemap.change_filter'
Expand All @@ -15,3 +18,12 @@ services:
class: FreshAdvance\Sitemap\ChangeFilter\Shared\Repository\ModelItemRepository
arguments:
$model: '\OxidEsales\Eshop\Application\Model\Category'

FreshAdvance\Sitemap\ChangeFilter\Category\CategoryUrlType:
class: FreshAdvance\Sitemap\Url\DataType\UrlType
arguments:
$objectType: '%sitemap.object_type.category%'
$changeFrequency: 'daily'
$priority: 0.7
tags:
- 'sitemap.page_type_configuration'
14 changes: 13 additions & 1 deletion src/ChangeFilter/Content/services.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
parameters:
sitemap.object_type.content: 'content'

services:

_defaults:
Expand All @@ -6,7 +9,7 @@ services:

FreshAdvance\Sitemap\ChangeFilter\Content\ContentChangeFilter:
arguments:
$pageTypeConfiguration: '@FreshAdvance\Sitemap\Url\DataTypeFactory\ContentUrlType'
$objectType: '%sitemap.object_type.content%'
$modelItemRepository: '@FreshAdvance\Sitemap\ChangeFilter\Content\ContentChangeFilterItemRepository'
tags:
- 'sitemap.change_filter'
Expand All @@ -15,3 +18,12 @@ services:
class: FreshAdvance\Sitemap\ChangeFilter\Shared\Repository\ModelItemRepository
arguments:
$model: '\OxidEsales\Eshop\Application\Model\Content'

FreshAdvance\Sitemap\ChangeFilter\Content\ContentUrlType:
class: FreshAdvance\Sitemap\Url\DataType\UrlType
arguments:
$objectType: '%sitemap.object_type.content%'
$changeFrequency: 'weekly'
$priority: 0.3
tags:
- 'sitemap.page_type_configuration'
14 changes: 13 additions & 1 deletion src/ChangeFilter/Product/services.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
parameters:
sitemap.object_type.product: 'product'

services:

_defaults:
Expand All @@ -6,7 +9,7 @@ services:

FreshAdvance\Sitemap\ChangeFilter\Product\ProductChangeFilter:
arguments:
$pageTypeConfiguration: '@FreshAdvance\Sitemap\Url\DataTypeFactory\ProductUrlType'
$objectType: '%sitemap.object_type.product%'
$modelItemRepository: '@FreshAdvance\Sitemap\ChangeFilter\Product\ProductChangeFilterItemRepository'
tags:
- 'sitemap.change_filter'
Expand All @@ -15,3 +18,12 @@ services:
class: FreshAdvance\Sitemap\ChangeFilter\Shared\Repository\ModelItemRepository
arguments:
$model: '\OxidEsales\Eshop\Application\Model\Article'

FreshAdvance\Sitemap\ChangeFilter\Product\ProductUrlType:
class: FreshAdvance\Sitemap\Url\DataType\UrlType
arguments:
$objectType: '%sitemap.object_type.product%'
$changeFrequency: 'daily'
$priority: 0.4
tags:
- 'sitemap.page_type_configuration'
4 changes: 2 additions & 2 deletions src/ChangeFilter/Shared/ChangeFilterTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class ChangeFilterTemplate

public function __construct(
ConnectionProviderInterface $connectionProvider,
protected UrlTypeInterface $pageTypeConfiguration,
protected string $objectType,
protected ModelItemRepositoryInterface $modelItemRepository,
) {
$this->connection = $connectionProvider->get();
Expand Down Expand Up @@ -57,7 +57,7 @@ public function queryAndFetchObjectUrl(string $query, array $queryParameters): G

public function getObjectType(): string
{
return $this->pageTypeConfiguration->getObjectType();
return $this->objectType;
}

protected function getQueryParameters(): array
Expand Down
27 changes: 0 additions & 27 deletions src/Url/DataTypeFactory/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,3 @@ services:
$objectType: 'default'
$changeFrequency: 'daily'
$priority: 0.5

FreshAdvance\Sitemap\Url\DataTypeFactory\ProductUrlType:
class: FreshAdvance\Sitemap\Url\DataType\UrlType
arguments:
$objectType: 'product'
$changeFrequency: 'daily'
$priority: 0.4
tags:
- 'sitemap.page_type_configuration'

FreshAdvance\Sitemap\Url\DataTypeFactory\CategoryUrlType:
class: FreshAdvance\Sitemap\Url\DataType\UrlType
arguments:
$objectType: 'category'
$changeFrequency: 'daily'
$priority: 0.7
tags:
- 'sitemap.page_type_configuration'

FreshAdvance\Sitemap\Url\DataTypeFactory\ContentUrlType:
class: FreshAdvance\Sitemap\Url\DataType\UrlType
arguments:
$objectType: 'content'
$changeFrequency: 'weekly'
$priority: 0.3
tags:
- 'sitemap.page_type_configuration'

0 comments on commit abe5ca3

Please sign in to comment.