diff --git a/.github/workflows/codeception.yml b/.github/workflows/codeception.yml index fb028dc..aab24ce 100644 --- a/.github/workflows/codeception.yml +++ b/.github/workflows/codeception.yml @@ -125,7 +125,7 @@ jobs: run: | composer config "minimum-stability" "dev" composer config "prefer-stable" true - sed -i 's,\("dachcom-digital\/social-data"\): "\(.*\)",\1: "2.x-dev",g' ${{ github.workspace }}/lib/test-bundle/composer.json + sed -i 's,\("dachcom-digital\/social-data"\): "\(.*\)",\1: "3.x-dev",g' ${{ github.workspace }}/lib/test-bundle/composer.json chmod +x ./pimcore-codeception-framework/src/_etc/scripts/composer.sh ./pimcore-codeception-framework/src/_etc/scripts/composer.sh diff --git a/.github/workflows/ecs.yml b/.github/workflows/ecs.yml index 13238f2..917e4ca 100644 --- a/.github/workflows/ecs.yml +++ b/.github/workflows/ecs.yml @@ -105,7 +105,7 @@ jobs: run: | composer config "minimum-stability" "dev" composer config "prefer-stable" true - sed -i 's,\("dachcom-digital\/social-data"\): "\(.*\)",\1: "2.x-dev",g' ${{ github.workspace }}/lib/test-bundle/composer.json + sed -i 's,\("dachcom-digital\/social-data"\): "\(.*\)",\1: "3.x-dev",g' ${{ github.workspace }}/lib/test-bundle/composer.json chmod +x ./pimcore-codeception-framework/src/_etc/scripts/composer.sh ./pimcore-codeception-framework/src/_etc/scripts/composer.sh diff --git a/.github/workflows/php-stan.yml b/.github/workflows/php-stan.yml index c0be081..b5fca1a 100644 --- a/.github/workflows/php-stan.yml +++ b/.github/workflows/php-stan.yml @@ -105,7 +105,7 @@ jobs: run: | composer config "minimum-stability" "dev" composer config "prefer-stable" true - sed -i 's,\("dachcom-digital\/social-data"\): "\(.*\)",\1: "2.x-dev",g' ${{ github.workspace }}/lib/test-bundle/composer.json + sed -i 's,\("dachcom-digital\/social-data"\): "\(.*\)",\1: "3.x-dev",g' ${{ github.workspace }}/lib/test-bundle/composer.json chmod +x ./pimcore-codeception-framework/src/_etc/scripts/composer.sh ./pimcore-codeception-framework/src/_etc/scripts/composer.sh diff --git a/LICENSE.md b/LICENSE.md index 26fe60d..b1a5fc8 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,5 +1,5 @@ # License -Copyright (C) 2022 DACHCOM.DIGITAL +Copyright (C) 2023 DACHCOM.DIGITAL This software is available under the GNU General Public License version 3 (GPLv3). diff --git a/README.md b/README.md index 1be97e7..d57aaa2 100644 --- a/README.md +++ b/README.md @@ -12,36 +12,27 @@ This Connector allows you to fetch social posts from Facebook. ### Release Plan | Release | Supported Pimcore Versions | Supported Symfony Versions | Release Date | Maintained | Branch | |---------|----------------------------|----------------------------|--------------|----------------|-------------------------------------------------------------------------------------------| -| **2.x** | `10.1` - `10.6` | `5.4` | 05.01.2022 | Feature Branch | master | +| **3.x** | `11.0` | `6.2` | -- | Feature Branch | master | +| **2.x** | `10.1` - `10.6` | `5.4` | 05.01.2022 | Unsupported | [2.x](https://github.com/dachcom-digital/pimcore-social-data-facebook-connector/tree/2.x) | | **1.x** | `6.0` - `6.9` | `3.4`, `^4.4` | 22.10.2020 | Unsupported | [1.x](https://github.com/dachcom-digital/pimcore-social-data-facebook-connector/tree/1.x) | ## Installation -### I. Add Dependency ```json "require" : { - "dachcom-digital/social-data" : "~2.0.0", - "dachcom-digital/social-data-facebook-connector" : "~2.1.0", + "dachcom-digital/social-data" : "~3.0.0", + "dachcom-digital/social-data-facebook-connector" : "~3.0.0" } ``` -### II. Register Connector Bundle +Add Bundle to `bundles.php`: ```php -// src/Kernel.php -namespace App; - -use Pimcore\HttpKernel\BundleCollection\BundleCollection; - -class Kernel extends \Pimcore\Kernel -{ - public function registerBundlesToCollection(BundleCollection $collection) - { - $collection->addBundle(new SocialData\Connector\Facebook\SocialDataFacebookConnectorBundle()); - } -} +return [ + SocialData\Connector\Facebook\SocialDataFacebookConnectorBundle::class => ['all' => true], +]; ``` -### III. Install Assets +### Install Assets ```bash bin/console assets:install public --relative --symlink ``` @@ -89,10 +80,10 @@ Otherwise, you'll receive an error message. You may then need to repeat the conn ## Feed Configuration -| Name | Description -|------|----------------------| -| `Page Id` | Defines which page entries should be imported | -| `Limit` | Define a limit to restrict the amount of social posts to import (Default: 50) | +| Name | Description | +|-----------|-------------------------------------------------------------------------------| +| `Page Id` | Defines which page entries should be imported | +| `Limit` | Define a limit to restrict the amount of social posts to import (Default: 50) | ## Extended Connector Configuration Normally you don't need to modify connector (`connector_config`) configuration, so most of the time you can skip this step. diff --git a/UPGRADE.md b/UPGRADE.md index f9ba908..857c4ae 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,14 +1,6 @@ # Upgrade Notes -## 2.1.1 -- [BUGFIX] Improve fallback when parsing the date [#9](https://github.com/dachcom-digital/pimcore-social-data-facebook-connector/issues/9) - -## 2.1.0 -- [BUGFIX] Use Page Access Token [#6](https://github.com/dachcom-digital/pimcore-social-data-facebook-connector/issues/6) - -## Migrating from Version 1.x to Version 2.0.0 +## Migrating from Version 2.x to Version 3.0.0 ### Global Changes -- ⚠️ You need to set `framework.session.cookie_samesite` to `lax`, otherwise the OAuth connection won't work -- PHP8 return type declarations added: you may have to adjust your extensions accordingly -- Library `facebookarchive/php-graph-sdk` has been removed, we're now using the `league/oauth2-facebook` package which will be installed by default +- Recommended folder structure by symfony adopted \ No newline at end of file diff --git a/config/pimcore/config.yml b/config/pimcore/config.yaml similarity index 100% rename from config/pimcore/config.yml rename to config/pimcore/config.yaml diff --git a/config/pimcore/routing.yml b/config/pimcore/routing.yaml similarity index 100% rename from config/pimcore/routing.yml rename to config/pimcore/routing.yaml diff --git a/config/services.yml b/config/services.yaml similarity index 86% rename from config/services.yml rename to config/services.yaml index 79b1fe2..0212029 100644 --- a/config/services.yml +++ b/config/services.yaml @@ -37,3 +37,9 @@ services: SocialData\Connector\Facebook\Controller\Admin\FacebookController: tags: [ 'controller.service_arguments' ] + + ## Events + + SocialData\Connector\Facebook\EventListener\Admin\AssetListener: + tags: + - { name: kernel.event_subscriber } diff --git a/src/DependencyInjection/SocialDataFacebookConnectorExtension.php b/src/DependencyInjection/SocialDataFacebookConnectorExtension.php index f90bd2d..51a7c44 100644 --- a/src/DependencyInjection/SocialDataFacebookConnectorExtension.php +++ b/src/DependencyInjection/SocialDataFacebookConnectorExtension.php @@ -15,6 +15,6 @@ public function load(array $configs, ContainerBuilder $container): void $this->processConfiguration($configuration, $configs); $loader = new YamlFileLoader($container, new FileLocator([__DIR__ . '/../../config'])); - $loader->load('services.yml'); + $loader->load('services.yaml'); } } diff --git a/src/EventListener/Admin/AssetListener.php b/src/EventListener/Admin/AssetListener.php new file mode 100644 index 0000000..5b24c32 --- /dev/null +++ b/src/EventListener/Admin/AssetListener.php @@ -0,0 +1,33 @@ + 'addCssFiles', + BundleManagerEvents::JS_PATHS => 'addJsFiles', + ]; + } + + public function addCssFiles(PathsEvent $event): void + { + $event->addPaths([ + '/bundles/socialdatafacebookconnector/css/admin.css' + ]); + } + + public function addJsFiles(PathsEvent $event): void + { + $event->addPaths([ + '/bundles/socialdatafacebookconnector/js/connector/facebook-connector.js', + '/bundles/socialdatafacebookconnector/js/feed/facebook-feed.js', + ]); + } +} diff --git a/src/SocialDataFacebookConnectorBundle.php b/src/SocialDataFacebookConnectorBundle.php index e219a6b..b165e9d 100644 --- a/src/SocialDataFacebookConnectorBundle.php +++ b/src/SocialDataFacebookConnectorBundle.php @@ -2,32 +2,22 @@ namespace SocialData\Connector\Facebook; -use Pimcore\Extension\Bundle\AbstractPimcoreBundle; use Pimcore\Extension\Bundle\Traits\PackageVersionTrait; +use Symfony\Component\HttpKernel\Bundle\Bundle; -class SocialDataFacebookConnectorBundle extends AbstractPimcoreBundle +class SocialDataFacebookConnectorBundle extends Bundle { use PackageVersionTrait; public const PACKAGE_NAME = 'dachcom-digital/social-data-facebook-connector'; - protected function getComposerPackageName(): string + public function getPath(): string { - return self::PACKAGE_NAME; + return \dirname(__DIR__); } - public function getCssPaths(): array - { - return [ - '/bundles/socialdatafacebookconnector/css/admin.css' - ]; - } - - public function getJsPaths(): array + protected function getComposerPackageName(): string { - return [ - '/bundles/socialdatafacebookconnector/js/connector/facebook-connector.js', - '/bundles/socialdatafacebookconnector/js/feed/facebook-feed.js', - ]; + return self::PACKAGE_NAME; } }