Skip to content

Commit

Permalink
pimcore 11 suport
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat committed Aug 10, 2023
1 parent 6b0cd77 commit 8b8deb6
Show file tree
Hide file tree
Showing 39 changed files with 109 additions and 107 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -13,9 +13,10 @@ final class SchemaGeneratorAdapterPass implements CompilerPassInterface
public function process(ContainerBuilder $container): void
{
foreach ($container->findTaggedServiceIds('schema.generator', true) as $id => $tags) {

$definition = $container->getDefinition(SchemaGeneratorRegistry::class);

if ($container->getParameter('schema.flag.schema_listener_removed') === true) {
if ($container->hasParameter('schema.third_party.seo.enabled') && $container->getParameter('schema.third_party.seo.enabled') === true) {
$message = sprintf(
'Cannot register schema generator "%s" because you have installed the SEO Bundle. If you want to add some fragment generator (via twig) use the "schema.fragment_generator" tag. Read more about it here: %s',
$id,
Expand Down
File renamed without changes.
39 changes: 39 additions & 0 deletions src/DependencyInjection/SchemaExtension.php
@@ -0,0 +1,39 @@
<?php

namespace SchemaBundle\DependencyInjection;

use SchemaBundle\EventListener\SchemaListener;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;

class SchemaExtension extends Extension implements PrependExtensionInterface
{
public function load(array $configs, ContainerBuilder $container): void
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);

$loader = new YamlFileLoader($container, new FileLocator([__DIR__ . '/../../config']));
$loader->load('services.yaml');
}

public function prepend(ContainerBuilder $container)
{
if ($container->hasExtension('seo')) {
return;
}

$loader = new YamlFileLoader($container, new FileLocator([__DIR__ . '/../../config']));

$container->setParameter('schema.third_party.seo.enabled', true);

$loader->load('third_party/seo.yaml');

if ($container->hasDefinition(SchemaListener::class)) {
$container->removeDefinition(SchemaListener::class);
}
}
}
Expand Up @@ -11,22 +11,15 @@

class SchemaListener implements EventSubscriberInterface
{
protected SchemaRequestProcessorInterface $schemaRequestProcessor;
protected RequestHelper $requestHelper;
protected PimcoreContextResolver $pimcoreContextResolver;

/**
* This service is only available in standalone mode.
* If you've installed the SEO Bundle, this class is not available!
*/
public function __construct(
SchemaRequestProcessorInterface $schemaRequestProcessor,
RequestHelper $requestHelper,
PimcoreContextResolver $contextResolver
protected SchemaRequestProcessorInterface $schemaRequestProcessor,
protected RequestHelper $requestHelper,
protected PimcoreContextResolver $pimcoreContextResolver
) {
$this->schemaRequestProcessor = $schemaRequestProcessor;
$this->requestHelper = $requestHelper;
$this->pimcoreContextResolver = $contextResolver;
}

public static function getSubscribedEvents(): array
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -7,11 +7,8 @@

class SchemaElementProcessor implements SchemaElementProcessorInterface
{
protected SchemaGeneratorRegistryInterface $generatorRegistry;

public function __construct(SchemaGeneratorRegistryInterface $generatorRegistry)
public function __construct(protected SchemaGeneratorRegistryInterface $generatorRegistry)
{
$this->generatorRegistry = $generatorRegistry;
}

public function process($element): string
Expand Down
Expand Up @@ -10,15 +10,10 @@

class SchemaRequestProcessor implements SchemaRequestProcessorInterface
{
protected HeadMeta $headMeta;
protected SchemaGeneratorRegistryInterface $generatorRegistry;

public function __construct(
HeadMeta $headMeta,
SchemaGeneratorRegistryInterface $generatorRegistry
protected HeadMeta $headMeta,
protected SchemaGeneratorRegistryInterface $generatorRegistry
) {
$this->headMeta = $headMeta;
$this->generatorRegistry = $generatorRegistry;
}

public function process(Request $request): void
Expand All @@ -38,10 +33,6 @@ public function process(Request $request): void
$this->appendHeadMeta($graph, $schemaBlocks);
}

/**
* @param Graph $graph
* @param array $schemaBlocks
*/
protected function appendHeadMeta(Graph $graph, array $schemaBlocks): void
{
$nodes = $graph->getNodes();
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions src/SchemaBundle/SchemaBundle.php → src/SchemaBundle.php
Expand Up @@ -24,6 +24,11 @@ public function build(ContainerBuilder $container): void
$container->addCompilerPass(new SchemaGeneratorAdapterPass());
}

public function getPath(): string
{
return \dirname(__DIR__);
}

protected function getComposerPackageName(): string
{
return self::PACKAGE_NAME;
Expand Down
37 changes: 0 additions & 37 deletions src/SchemaBundle/DependencyInjection/SchemaExtension.php

This file was deleted.

File renamed without changes.
5 changes: 0 additions & 5 deletions src/SchemaBundle/Tool/Install.php → src/Tool/Install.php
Expand Up @@ -6,10 +6,5 @@

class Install extends SettingsStoreAwareInstaller
{
public function install()
{
// currently, nothing to do.

parent::install();
}
}
Expand Up @@ -8,11 +8,8 @@

class JsonLdExtension extends AbstractExtension
{
protected SchemaElementProcessorInterface $schemaElementProcessor;

public function __construct(SchemaElementProcessorInterface $schemaElementProcessor)
public function __construct(protected SchemaElementProcessorInterface $schemaElementProcessor)
{
$this->schemaElementProcessor = $schemaElementProcessor;
}

public function getFilters(): array
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
56 changes: 56 additions & 0 deletions tests/_etc/config/app/config.yaml
@@ -0,0 +1,56 @@
imports:
- { resource: services.yaml }
- { resource: 'local/' }

services:
App\Controller\DefaultController:
public: true
autowire: true
autoconfigure: true
calls:
- [setContainer, ['@service_container']]

doctrine:
dbal:
connections:
default:
mapping_types:
enum: string
bit: boolean

pimcore:
config_location:
image_thumbnails:
write_target:
type: 'settings-store'
video_thumbnails:
write_target:
type: 'settings-store'
document_types:
write_target:
type: 'settings-store'
predefined_properties:
write_target:
type: 'settings-store'
predefined_asset_metadata:
write_target:
type: 'settings-store'
perspectives:
write_target:
type: 'settings-store'
custom_views:
write_target:
type: 'settings-store'
object_custom_layouts:
write_target:
type: 'settings-store'

framework:
profiler:
enabled: true
collect: false
# don't send real emails in functional tests
mailer:
transports:
main: 'null://null'
pimcore_newsletter: 'null://null'
29 changes: 0 additions & 29 deletions tests/_etc/config/app/config.yml

This file was deleted.

Expand Up @@ -36,12 +36,6 @@ pimcore:
email:
debug:
email_addresses: opensource@dachcom.ch
services:
google:
client_id: ''
email: ''
simple_api_key: ''
browser_api_key: ''
full_page_cache:
exclude_cookie: ''
enabled: false
Expand Down
File renamed without changes.

0 comments on commit 8b8deb6

Please sign in to comment.