Skip to content

Commit

Permalink
Restructure and rename (#41)
Browse files Browse the repository at this point in the history
* Introduce abstraction layer to create different filter services

* Add missing headers

* Apply php-cs-fixer changes

* Change to provider instead of factory, move trait

* Cleanup

* Update qodana.yml

* Try to restructure project setup (#43)

* Try to restructure folders

* More restructuring

* Split up security

* Restructure and rename

* Apply php-cs-fixer changes

---------

Co-authored-by: mattamon <[email protected]>

* Remove unused const

* Make OpenApiService readonly

* Order yaml file loads by alphabet

* Exclude attributes for long inheritance chain

* Remove php ending

* Restructure security and icon services

* Try to restructure more

* Refactor to the max!

* Apply php-cs-fixer changes

* Include use statements

* Some more imports were missing

* Update qodana baseline

---------

Co-authored-by: mattamon <[email protected]>
Co-authored-by: Herbert Roth <[email protected]>
  • Loading branch information
3 people authored Apr 25, 2024
1 parent 3080b8c commit f78d89e
Show file tree
Hide file tree
Showing 205 changed files with 4,778 additions and 2,418 deletions.
2 changes: 1 addition & 1 deletion .github/ci/files/config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

return [
'Pimcore\\Bundle\\StudioApiBundle\\PimcoreStudioApiBundle' => ['all' => true],
'Pimcore\\Bundle\\StudioBackendBundle\\PimcoreStudioBackendBundle' => ['all' => true],
];
6 changes: 3 additions & 3 deletions .github/ci/files/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ services:
#
# INSTALLER
#
Pimcore\Bundle\StudioApiBundle\Installer:
Pimcore\Bundle\StudioBackendBundle\Installer:
public: true
arguments:
$bundle: "@=service('kernel').getBundle('PimcoreStudioApiBundle')"
$bundle: "@=service('kernel').getBundle('PimcoreStudioBackendBundle')"

# controllers are imported separately to make sure they're public
# and have a tag that allows actions to type-hint services
Pimcore\Bundle\StudioApiBundle\Controller\:
Pimcore\Bundle\StudioBackendBundle\Controller\:
resource: '../src/Controller'
public: true
tags: [ 'controller.service_arguments' ]
4 changes: 2 additions & 2 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace: Pimcore\Bundle\StudioApiBundle\Tests
namespace: Pimcore\Bundle\StudioBackendBundle\Tests
bootstrap: _bootstrap.php

settings:
Expand All @@ -21,4 +21,4 @@ coverage:
- src/DependencyInjection/*
- src/Repository/*
- src/Installer.php
- src/PimcoreStudioApiBundle.php
- src/PimcoreStudioBackendBundle.php
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pimcore/studio-api-bundle",
"license": "proprietary",
"type": "pimcore-bundle",
"description": "Pimcore Studio Api Bundle",
"description": "Pimcore Studio Backend Bundle",
"config": {
"discard-changes": true,
"sort-packages": true,
Expand Down Expand Up @@ -39,19 +39,19 @@
},
"autoload": {
"psr-4": {
"Pimcore\\Bundle\\StudioApiBundle\\": "src/",
"Pimcore\\Bundle\\StudioBackendBundle\\": "src/",
"Pimcore\\": "core-extension/Pimcore/"
}
},
"autoload-dev": {
"psr-4": {
"Pimcore\\Bundle\\StudioApiBundle\\Tests\\": "tests"
"Pimcore\\Bundle\\StudioBackendBundle\\Tests\\": "tests"
}
},
"extra": {
"pimcore": {
"bundles": [
"Pimcore\\Bundle\\StudioApiBundle\\PimcoreStudioApiBundle"
"PimcoreStudioBackendBundle"
]
}
}
Expand Down
12 changes: 12 additions & 0 deletions config/assets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

# controllers are imported separately to make sure they're public
# and have a tag that allows actions to type-hint services
Pimcore\Bundle\StudioBackendBundle\Asset\Controller\:
resource: '../src/Asset/Controller'
public: true
tags: [ 'controller.service_arguments' ]
17 changes: 17 additions & 0 deletions config/authorization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false


# controllers are imported separately to make sure they're public
# and have a tag that allows actions to type-hint services
Pimcore\Bundle\StudioBackendBundle\Authorization\Controller\:
resource: '../src/Authorization/Controller'
public: true
tags: [ 'controller.service_arguments' ]


Pimcore\Bundle\StudioBackendBundle\Authorization\Service\TokenServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\Authorization\Service\TokenService
73 changes: 73 additions & 0 deletions config/data_index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

# Hydrators
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\ArchiveHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\ArchiveHydrator
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\AudioHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\AudioHydrator
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\DocumentHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\DocumentHydrator
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\FolderHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\FolderHydrator
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\ImageHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\ImageHydrator
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\TextHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\TextHydrator
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\UnknownHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\UnknownHydrator
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\VideoHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\VideoHydrator
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\MetaDataHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\MetaDataHydrator

Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\AssetHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\AssetHydrator

Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\PermissionsHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\PermissionsHydrator

# Services
Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\AssetHydratorServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\AssetHydratorService
arguments:
$assetHydratorLocator: '@open_search.asset_hydrator.service_locator'


# Assets
Pimcore\Bundle\StudioBackendBundle\DataIndex\AssetSearchServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\AssetSearchService

Pimcore\Bundle\StudioBackendBundle\DataIndex\Adapter\AssetSearchAdapterInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Adapter\AssetSearchAdapter

Pimcore\Bundle\StudioBackendBundle\DataIndex\Provider\AssetQueryProviderInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Provider\AssetQueryProvider

#Data Objects
Pimcore\Bundle\StudioBackendBundle\DataIndex\DataObjectSearchServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\DataObjectSearchService

Pimcore\Bundle\StudioBackendBundle\DataIndex\Adapter\DataObjectSearchAdapterInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Adapter\DataObjectSearchAdapter

Pimcore\Bundle\StudioBackendBundle\DataIndex\Provider\DataObjectQueryProviderInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Provider\DataObjectQueryProvider


#Service Locator
open_search.asset_hydrator.service_locator:
class: Symfony\Component\DependencyInjection\ServiceLocator
tags: [ 'container.service_locator' ]
arguments:
- Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\SearchResultItem\Archive: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\ArchiveHydratorInterface'
Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\SearchResultItem\Audio: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\AudioHydratorInterface'
Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\SearchResultItem\Document: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\DocumentHydratorInterface'
Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\SearchResultItem\Folder: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\FolderHydratorInterface'
Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\SearchResultItem\Image: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\ImageHydratorInterface'
Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\SearchResultItem\Text: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\TextHydratorInterface'
Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\SearchResultItem\Unknown: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\UnknownHydratorInterface'
Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Asset\SearchResult\SearchResultItem\Video: '@Pimcore\Bundle\StudioBackendBundle\DataIndex\Hydrator\Asset\VideoHydratorInterface'
37 changes: 37 additions & 0 deletions config/data_index_filters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

#Filter

#Common
Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\FilterLoaderInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\Loader\TaggedIteratorAdapter

Pimcore\Bundle\StudioBackendBundle\DataIndex\OpenSearchFilterInterface:
class: Pimcore\Bundle\StudioBackendBundle\DataIndex\OpenSearchFilter
tags: [ 'pimcore.studio_api.filter_service' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\PageFilter:
tags: [ 'pimcore.studio_api.open_search.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\PageSizeFilter:
tags: [ 'pimcore.studio_api.open_search.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\ExcludeFolderFilter:
tags: [ 'pimcore.studio_api.open_search.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\IdSearchFilter:
tags: [ 'pimcore.studio_api.open_search.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\ParentIdFilter:
tags: [ 'pimcore.studio_api.open_search.filter' ]

Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\PathFilter:
tags: [ 'pimcore.studio_api.open_search.filter' ]

# DataObject
Pimcore\Bundle\StudioBackendBundle\DataIndex\Filter\DataObject\ClassNameFilter:
tags: [ 'pimcore.studio_api.open_search.data_object.filter' ]
12 changes: 12 additions & 0 deletions config/data_objects.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

# controllers are imported separately to make sure they're public
# and have a tag that allows actions to type-hint services
Pimcore\Bundle\StudioBackendBundle\DataObject\Controller\:
resource: '../src/DataObject/Controller'
public: true
tags: [ 'controller.service_arguments' ]
4 changes: 2 additions & 2 deletions config/event_subscribers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ services:
public: false

#Subscriber
Pimcore\Bundle\StudioApiBundle\EventSubscriber\CorsSubscriber:
Pimcore\Bundle\StudioBackendBundle\EventSubscriber\CorsSubscriber:
tags: [ 'kernel.event_subscriber' ]

Pimcore\Bundle\StudioApiBundle\EventSubscriber\ApiExceptionSubscriber:
Pimcore\Bundle\StudioBackendBundle\EventSubscriber\ApiExceptionSubscriber:
tags: [ 'kernel.event_subscriber' ]
arguments: ["%kernel.environment%"]
9 changes: 9 additions & 0 deletions config/factories.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

#Factory
Pimcore\Bundle\StudioBackendBundle\Factory\QueryFactoryInterface:
class: Pimcore\Bundle\StudioBackendBundle\Factory\QueryFactory
33 changes: 5 additions & 28 deletions config/filters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,10 @@ services:
autoconfigure: true
public: false

#Filter
#Factory

#Common
Pimcore\Bundle\StudioApiBundle\Service\Filter\FilterLoaderInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\Filter\Loader\TaggedIteratorAdapter
Pimcore\Bundle\StudioBackendBundle\Filter\Service\FilterServiceProviderInterface:
class: Pimcore\Bundle\StudioBackendBundle\Filter\Service\FilterServiceProvider

Pimcore\Bundle\StudioApiBundle\Service\Filter\FilterServiceInterface:
class: Pimcore\Bundle\StudioApiBundle\Service\Filter\FilterService

Pimcore\Bundle\StudioApiBundle\Filter\PageFilter:
tags: [ 'pimcore.studio_api.filter' ]

Pimcore\Bundle\StudioApiBundle\Filter\PageSizeFilter:
tags: [ 'pimcore.studio_api.filter' ]

Pimcore\Bundle\StudioApiBundle\Filter\ExcludeFolderFilter:
tags: [ 'pimcore.studio_api.filter' ]

Pimcore\Bundle\StudioApiBundle\Filter\IdSearchFilter:
tags: [ 'pimcore.studio_api.filter' ]

Pimcore\Bundle\StudioApiBundle\Filter\ParentIdFilter:
tags: [ 'pimcore.studio_api.filter' ]

Pimcore\Bundle\StudioApiBundle\Filter\PathFilter:
tags: [ 'pimcore.studio_api.filter' ]

# DataObject
Pimcore\Bundle\StudioApiBundle\Filter\DataObject\ClassNameFilter:
tags: [ 'pimcore.studio_api.data_object.filter' ]
Pimcore\Bundle\StudioBackendBundle\Filter\Service\FilterServiceLoaderInterface:
class: Pimcore\Bundle\StudioBackendBundle\Filter\Service\Loader\TaggedIteratorAdapter
8 changes: 8 additions & 0 deletions config/icon.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

Pimcore\Bundle\StudioBackendBundle\Icon\Service\IconServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\Icon\Service\IconService
17 changes: 17 additions & 0 deletions config/open_api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false


# controllers are imported separately to make sure they're public
# and have a tag that allows actions to type-hint services
Pimcore\Bundle\StudioBackendBundle\OpenApi\Controller\:
resource: '../src/OpenApi/Controller'
public: true
tags: [ 'controller.service_arguments' ]


Pimcore\Bundle\StudioBackendBundle\OpenApi\Service\OpenApiServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\OpenApi\Service\OpenApiService
6 changes: 5 additions & 1 deletion config/pimcore/config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
pimcore:
translations:
domains:
- studio
- studio

pimcore_studio_backend:
open_api_scan_paths:
- "%kernel.project_dir%/vendor/pimcore/studio-api-bundle/src"
2 changes: 1 addition & 1 deletion config/pimcore/routing.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
studio_api:
resource: "../../src/Controller/Api"
resource: "../../src/"
type: annotation
prefix: /studio/api
options:
Expand Down
19 changes: 19 additions & 0 deletions config/security.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

#Voters
Pimcore\Bundle\StudioBackendBundle\Security\Voter\AuthorizationVoter:
arguments: ['@request_stack']
tags:
- { name: security.voter }

Pimcore\Bundle\StudioBackendBundle\Security\Voter\PublicAuthorizationVoter:
arguments: [ '@request_stack' ]
tags:
- { name: security.voter }

Pimcore\Bundle\StudioBackendBundle\Security\Service\SecurityServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\Security\Service\SecurityService
Loading

0 comments on commit f78d89e

Please sign in to comment.