Skip to content

Commit

Permalink
[Task] Add BundleSetupSubscriber (#149)
Browse files Browse the repository at this point in the history
* Add BundleSetupSubscriber

* Adding AdminBundle

* Require AdminBundle

* add excluded from bundles.php flag

* Add RC1 conflict

* Remove dev repos

* Fix wrong files
  • Loading branch information
mattamon committed May 12, 2023
1 parent 6c66ff3 commit 0c70d15
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"symfony/dotenv": "^6.2"
},
"conflict": {
"pimcore/pimcore": "v11.0.0-ALPHA1 || v11.0.0-ALPHA2 || v11.0.0-ALPHA3 || v11.0.0-ALPHA4 || v11.0.0-ALPHA5 || v11.0.0-ALPHA6 || v11.0.0-ALPHA7 || v11.0.0-ALPHA8 || v11.0.0-BETA1",
"pimcore/pimcore": "v11.0.0-ALPHA1 || v11.0.0-ALPHA2 || v11.0.0-ALPHA3 || v11.0.0-ALPHA4 || v11.0.0-ALPHA5 || v11.0.0-ALPHA6 || v11.0.0-ALPHA7 || v11.0.0-ALPHA8 || v11.0.0-BETA1 || v11.0.0-RC1",
"pimcore/admin-ui-classic-bundle": "v1.0.0-BETA1"
},
"require-dev": {
Expand Down
15 changes: 15 additions & 0 deletions config/installer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
# default configuration for services in *this* file
_defaults:
# automatically injects dependencies in your services
autowire: true
# automatically registers your services as commands, event subscribers, etc.
autoconfigure: true
# this means you cannot fetch services directly from the container via $container->get()
# if you need to do this, you can override this setting on individual services
public: false

# ---------------------------------------------------------
# Event Subscribers
# ---------------------------------------------------------
App\EventSubscriber\BundleSetupSubscriber: ~
41 changes: 41 additions & 0 deletions src/EventSubscriber/BundleSetupSubscriber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace App\EventSubscriber;

use Pimcore\Bundle\AdminBundle\PimcoreAdminBundle;
use Pimcore\Bundle\InstallBundle\Event\BundleSetupEvent;
use Pimcore\Bundle\InstallBundle\Event\InstallEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class BundleSetupSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
InstallEvents::EVENT_BUNDLE_SETUP => [
['bundleSetup'],
],
];
}

public function bundleSetup(BundleSetupEvent $event): void
{
// add required PimcoreAdminBundle
$event->addRequiredBundle('PimcoreAdminBundle', PimcoreAdminBundle::class, true);
}
}

0 comments on commit 0c70d15

Please sign in to comment.