Skip to content

Commit

Permalink
Add missing service configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
Prokyonn committed Oct 22, 2024
1 parent 3b54d40 commit 3f74d69
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public function load(array $configs, ContainerBuilder $container)
}

if (
InstalledVersions::isInstalled('sulu/sulu-content-bundle')
&& \version_compare(InstalledVersions::getVersion('sulu/sulu-content-bundle') ?? '0.0.0', '0.9', '>=')
&& \version_compare(InstalledVersions::getVersion('sulu/sulu-content-bundle') ?? '0.0.0', '0.10', '<')
InstalledVersions::isInstalled('sulu/content-bundle')
&& \version_compare(InstalledVersions::getVersion('sulu/content-bundle') ?? '0.0.0', '0.9', '>=')
&& \version_compare(InstalledVersions::getVersion('sulu/content-bundle') ?? '0.0.0', '0.10', '<')
) {
$loader->load('services_content.xml');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

declare(strict_types=1);

/*
* This file is part of Sulu.
*
* (c) Sulu GmbH
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Sulu\Bundle\CategoryBundle\Infrastructure\Sulu\Content\PropertyResolver;

use Sulu\Bundle\CategoryBundle\Infrastructure\Sulu\Content\ResourceLoader\CategoryResourceLoader;
use Sulu\Bundle\ContentBundle\Content\Application\ContentResolver\Value\ContentView;
use Sulu\Bundle\ContentBundle\Content\Application\PropertyResolver\PropertyResolverInterface;

/**
* @internal if you need to override this service, create a new service with based on PropertyResolverInterface instead of extending this class
*
* @final
*/
class SingleCategorySelectionPropertyResolver implements PropertyResolverInterface
{
public function resolve(mixed $data, string $locale, array $params = []): ContentView
{
if (!\is_string($data) || '' === $data) {
return ContentView::create([], $params);
}

/** @var string $resourceLoaderKey */
$resourceLoaderKey = $params['resourceLoader'] ?? CategoryResourceLoader::getKey();

return ContentView::createResolvables(
$data,
$resourceLoaderKey,
$params,
);
}

public static function getType(): string
{
return 'single_category_selection';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<!-- Property Resolver -->
<service id="sulu_category.property_resolver.category_selection"
class="Sulu\Bundle\CategoryBundle\Infrastructure\Content\PropertyResolver\Resolver\CategorySelectionPropertyResolver">
<service id="sulu_category.category_selection_property_resolver"
class="Sulu\Bundle\CategoryBundle\Infrastructure\Sulu\Content\PropertyResolver\CategorySelectionPropertyResolver">
<tag name="sulu_content.property_resolver"/>
</service>

<service id="sulu_category.single_category_selection_property_resolver"
class="Sulu\Bundle\CategoryBundle\Infrastructure\Sulu\Content\PropertyResolver\CategorySelectionPropertyResolver">

<tag name="sulu_content.property_resolver"/>
</service>

<!-- Resource Loader -->
<service id="sulu_category.resource_loader.category"
class="Sulu\Bundle\CategoryBundle\Infrastructure\Content\ResourceLoader\CategoryResourceLoader">
<service id="sulu_category.category_resource_loader"
class="Sulu\Bundle\CategoryBundle\Infrastructure\Sulu\Content\ResourceLoader\CategoryResourceLoader">
<argument type="service" id="sulu_category.category_manager"/>

<tag name="sulu_content.resource_loader" type="media"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('command.xml');

if (
InstalledVersions::isInstalled('sulu/sulu-content-bundle')
&& \version_compare(InstalledVersions::getVersion('sulu/sulu-content-bundle') ?? '0.0.0', '0.9', '>=')
&& \version_compare(InstalledVersions::getVersion('sulu/sulu-content-bundle') ?? '0.0.0', '0.10', '<')
InstalledVersions::isInstalled('sulu/content-bundle')
&& \version_compare(InstalledVersions::getVersion('sulu/content-bundle') ?? '0.0.0', '0.9', '>=')
&& \version_compare(InstalledVersions::getVersion('sulu/content-bundle') ?? '0.0.0', '0.10', '<')
) {
$loader->load('services_content.xml');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,9 @@ public function load(array $configs, ContainerBuilder $container)
}

if (
InstalledVersions::isInstalled('sulu/sulu-content-bundle')
&& \version_compare(InstalledVersions::getVersion('sulu/sulu-content-bundle') ?? '0.0.0', '0.9', '>=')
&& \version_compare(InstalledVersions::getVersion('sulu/sulu-content-bundle') ?? '0.0.0', '0.10', '<')
InstalledVersions::isInstalled('sulu/content-bundle')
&& \version_compare(InstalledVersions::getVersion('sulu/content-bundle') ?? '0.0.0', '0.9', '>=')
&& \version_compare(InstalledVersions::getVersion('sulu/content-bundle') ?? '0.0.0', '0.10', '<')
) {
$loader->load('services_content.xml');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<!-- Property Resolver -->
<service id="sulu_media.property_resolver.media_selection"
class="Sulu\Bundle\MediaBundle\Infrastructure\Sulu\Content\PropertyResolver\Resolver\MediaSelectionPropertyResolver">
<service id="sulu_media.media_selection_property_resolver"
class="Sulu\Bundle\MediaBundle\Infrastructure\Sulu\Content\PropertyResolver\MediaSelectionPropertyResolver">
<tag name="sulu_content.property_resolver"/>
</service>

<!-- Resource Loader -->
<service id="sulu_media.resource_loader.media"
<service id="sulu_media.media_resource_loader"
class="Sulu\Bundle\MediaBundle\Infrastructure\Sulu\Content\ResourceLoader\MediaResourceLoader">
<argument type="service" id="sulu_media.media_manager"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Sulu\Bundle\TagBundle\DependencyInjection;

use Composer\InstalledVersions;
use Sulu\Bundle\PersistenceBundle\DependencyInjection\PersistenceExtensionTrait;
use Sulu\Bundle\TagBundle\Tag\TagInterface;
use Sulu\Bundle\TagBundle\Tag\TagRepositoryInterface;
Expand Down Expand Up @@ -93,5 +94,13 @@ public function load(array $configs, ContainerBuilder $container)
if (\array_key_exists('SuluTrashBundle', $bundles)) {
$loader->load('services_trash.xml');
}

if (
InstalledVersions::isInstalled('sulu/content-bundle')
&& \version_compare(InstalledVersions::getVersion('sulu/content-bundle') ?? '0.0.0', '0.9', '>=')
&& \version_compare(InstalledVersions::getVersion('sulu/content-bundle') ?? '0.0.0', '0.10', '<')
) {
$loader->load('services_content.xml');
}
}
}
18 changes: 18 additions & 0 deletions src/Sulu/Bundle/TagBundle/Resources/config/services_content.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<!-- Content Property Resolvers -->
<service id="sulu_tag.tag_selection_property_resolver" class="Sulu\Bundle\TagBundle\Infrastructure\Sulu\Content\PropertyResolver\TagSelectionPropertyResolver">
<tag name="sulu_content.property_resolver"/>
</service>

<!-- Content Resource Loaders -->
<service id="sulu_tag.tag_resource_loader" class="Sulu\Bundle\TagBundle\Infrastructure\Sulu\Content\ResourceLoader\TagResourceLoader">
<argument type="service" id="sulu.repository.tag"/>

<tag name="sulu_content.resource_loader"/>
</service>
</services>
</container>

0 comments on commit 3f74d69

Please sign in to comment.