Skip to content

Commit

Permalink
Pimcore 11 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat committed Nov 7, 2023
1 parent abb1eb1 commit 5d23210
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php-stan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down
35 changes: 13 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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.
Expand Down
12 changes: 2 additions & 10 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions config/services.yml → config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
33 changes: 33 additions & 0 deletions src/EventListener/Admin/AssetListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace SocialData\Connector\Facebook\EventListener\Admin;

use Pimcore\Event\BundleManager\PathsEvent;
use Pimcore\Event\BundleManagerEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class AssetListener implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
BundleManagerEvents::CSS_PATHS => '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',
]);
}
}
22 changes: 6 additions & 16 deletions src/SocialDataFacebookConnectorBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 5d23210

Please sign in to comment.