Skip to content

Commit

Permalink
Versions (#50)
Browse files Browse the repository at this point in the history
* feat: add versions endpoints

* Apply php-cs-fixer changes

* added new controllers to the baseline

* added test

* Apply php-cs-fixer changes

* sort swagger ui operations by methods

* add changes from feedback

---------

Co-authored-by: lukmzig <[email protected]>
  • Loading branch information
lukmzig and lukmzig authored May 2, 2024
1 parent 37c199f commit 9bbb0ce
Show file tree
Hide file tree
Showing 64 changed files with 4,799 additions and 1,444 deletions.
66 changes: 66 additions & 0 deletions config/versions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
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\Version\Controller\:
resource: '../src/Version/Controller'
public: true
tags: [ 'controller.service_arguments' ]

Pimcore\Bundle\StudioBackendBundle\Version\RepositoryInterface:
class: Pimcore\Bundle\StudioBackendBundle\Version\Repository

Pimcore\Bundle\StudioBackendBundle\Version\Hydrator\VersionHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\Version\Hydrator\VersionHydrator

# Hydrators
Pimcore\Bundle\StudioBackendBundle\Version\Hydrator\AssetVersionHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\Version\Hydrator\AssetVersionHydrator

Pimcore\Bundle\StudioBackendBundle\Version\Hydrator\DataObjectVersionHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\Version\Hydrator\DataObjectVersionHydrator

Pimcore\Bundle\StudioBackendBundle\Version\Hydrator\DocumentVersionHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\Version\Hydrator\DocumentVersionHydrator

# Publishers
Pimcore\Bundle\StudioBackendBundle\Version\Publisher\AssetVersionPublisherInterface:
class: Pimcore\Bundle\StudioBackendBundle\Version\Publisher\AssetVersionPublisher

Pimcore\Bundle\StudioBackendBundle\Version\Publisher\DataObjectVersionPublisherInterface:
class: Pimcore\Bundle\StudioBackendBundle\Version\Publisher\DataObjectVersionPublisher

Pimcore\Bundle\StudioBackendBundle\Version\Publisher\DocumentVersionPublisherInterface:
class: Pimcore\Bundle\StudioBackendBundle\Version\Publisher\DocumentVersionPublisher

# Services
Pimcore\Bundle\StudioBackendBundle\Version\Hydrator\VersionHydratorServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\Version\Hydrator\VersionHydratorService
arguments:
$versionHydratorLocator: '@listing.version_hydrator.service_locator'

Pimcore\Bundle\StudioBackendBundle\Version\Publisher\VersionPublisherServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\Version\Publisher\VersionPublisherService
arguments:
$versionPublisherLocator: '@version.element_publisher.service_locator'

#Service Locator
listing.version_hydrator.service_locator:
class: Symfony\Component\DependencyInjection\ServiceLocator
tags: [ 'container.service_locator' ]
arguments:
- Pimcore\Model\Asset: '@Pimcore\Bundle\StudioBackendBundle\Version\Hydrator\AssetVersionHydratorInterface'
Pimcore\Model\DataObject: '@Pimcore\Bundle\StudioBackendBundle\Version\Hydrator\DataObjectVersionHydratorInterface'
Pimcore\Model\Document: '@Pimcore\Bundle\StudioBackendBundle\Version\Hydrator\DocumentVersionHydratorInterface'

version.element_publisher.service_locator:
class: Symfony\Component\DependencyInjection\ServiceLocator
tags: [ 'container.service_locator' ]
arguments:
- Pimcore\Model\Asset: '@Pimcore\Bundle\StudioBackendBundle\Version\Publisher\AssetVersionPublisherInterface'
Pimcore\Model\DataObject: '@Pimcore\Bundle\StudioBackendBundle\Version\Publisher\DataObjectVersionPublisherInterface'
Pimcore\Model\Document: '@Pimcore\Bundle\StudioBackendBundle\Version\Publisher\DocumentVersionPublisherInterface'
4 changes: 4 additions & 0 deletions public/js/swagger-ui/swagger-initializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ window.onload = function() {
url: dataUrl,
dom_id: '#swagger-ui',
deepLinking: true,
operationsSorter: function(a, b) {
const order = ['POST', 'GET', 'PUT', 'PATCH', 'DELETE'];
return order.indexOf(a.get("method").toUpperCase()) - order.indexOf(b.get("method").toUpperCase());
},
presets: [
SwaggerUIBundle.presets.apis,
],
Expand Down
Loading

0 comments on commit 9bbb0ce

Please sign in to comment.