Skip to content

Commit

Permalink
Merge pull request #5 from dachcom-digital/p11
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat authored Nov 7, 2023
2 parents a50b677 + b92ccfd commit 0d439fa
Show file tree
Hide file tree
Showing 42 changed files with 2,928 additions and 231 deletions.
34 changes: 22 additions & 12 deletions .github/workflows/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}"

PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework"
PIMCORE_CODECEPTION_VERSION: "2.0"
PIMCORE_CODECEPTION_VERSION: "3.0"

APP_ENV: test
PIMCORE_TEST_DB_DSN: "mysql://root:root@127.0.0.1:3306/dachcom_bundle_test"
PIMCORE_TEST_DB_DSN: "mysql://test:test@127.0.0.1:3306/dachcom_bundle_test"
PIMCORE_TEST_URL: "http://localhost"
PIMCORE_CLASS_DIRECTORY: "${{ github.workspace }}/lib/test-bundle/tests/_output/var/classes/DataObject"
PIMCORE_CLASS_DIRECTORY: "${{ github.workspace }}/lib/test-bundle/tests/_output/var/classes"

SYMFONY_DEPRECATIONS_HELPER: "weak"
PIMCORE_PHP_ERROR_REPORTING: 32767
Expand All @@ -38,12 +38,12 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [ 8.1 ]
symfony: [ ^5.4 ]
pimcore: [ ~10.6.0 ]
php: [ 8.2 ]
symfony: [ ^6.2 ]
pimcore: [ ~11.0.0 ]
include:
- pimcore: ~10.6.0
template_tag: v10.2.5
- pimcore: ~11.0.0
template_tag: v11.0.0
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -82,9 +82,19 @@ jobs:
run: php -v

- name: Setup MySql
run: |
sudo systemctl start mysql
mysql -uroot -proot -h127.0.0.1 -e "CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;"
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: '8.0'
user: test
password: test
root-password: root
auto-start: true
my-cnf: |
max_allowed_packet=32505856
max_connections=1000
- name: Initial Database
run: mysql -utest -ptest -h127.0.0.1 -e 'CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;'

- name: Setup Chromium
run: |
Expand Down Expand Up @@ -115,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
14 changes: 7 additions & 7 deletions .github/workflows/ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}"

PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework"
PIMCORE_CODECEPTION_VERSION: "2.0"
PIMCORE_CODECEPTION_VERSION: "3.0"

APP_ENV: test
PIMCORE_TEST_DB_DSN: "mysql://root:[email protected]:3306/dachcom_bundle_test"
Expand All @@ -37,12 +37,12 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [ 8.1 ]
symfony: [ ^5.4 ]
pimcore: [ ~10.6.0 ]
php: [ 8.2 ]
symfony: [ ^6.2 ]
pimcore: [ ~11.0.0 ]
include:
- pimcore: ~10.6.0
template_tag: v10.2.5
- pimcore: ~11.0.0
template_tag: v11.0.0
steps:
- uses: actions/checkout@v2
with:
Expand Down 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
14 changes: 7 additions & 7 deletions .github/workflows/php-stan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}"

PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework"
PIMCORE_CODECEPTION_VERSION: "2.0"
PIMCORE_CODECEPTION_VERSION: "3.0"

APP_ENV: test
PIMCORE_TEST_DB_DSN: "mysql://root:[email protected]:3306/dachcom_bundle_test"
Expand All @@ -37,12 +37,12 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [ 8.1 ]
symfony: [ ^5.4 ]
pimcore: [ ~10.6.0 ]
php: [ 8.2 ]
symfony: [ ^6.2 ]
pimcore: [ ~11.0.0 ]
include:
- pimcore: ~10.6.0
template_tag: v10.2.5
- pimcore: ~11.0.0
template_tag: v11.0.0
steps:
- uses: actions/checkout@v2
with:
Expand Down 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) 2020 DACHCOM.DIGITAL
Copyright (C) 2023 DACHCOM.DIGITAL

This software is available under the GNU General Public License version 3 (GPLv3).

Expand Down
36 changes: 13 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,32 @@ This Connector allows you to fetch social posts from LinkedIn.
### 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` | 07.11.2023 | 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-linkedin-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-linkedin-connector/tree/1.x) |

## Installation

### I. Add Dependency
```json
"require" : {
"dachcom-digital/social-data" : "~2.0.0",
"dachcom-digital/social-data-linkedin-connector" : "~2.0.0",
"dachcom-digital/social-data" : "~3.0.0",
"dachcom-digital/social-data-linkedin-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\LinkedIn\SocialDataLinkedInConnectorBundle());
}
}
return [
SocialData\Connector\LinkedIn\SocialDataLinkedInConnectorBundle::class => ['all' => true],
];
```

### III. Install Assets
### Install Assets
```bash
bin/console assets:install public --relative --symlink
```

## Enable Connector

```yaml
# config/packages/social_data.yaml
social_data:
Expand Down Expand Up @@ -91,10 +81,10 @@ If everything worked out fine, the connection setup is complete after the popup
Otherwise, you'll receive an error message. You may then need to repeat the connection step.

## Feed Configuration
| Name | Description
|------|----------------------|
| `Company ID` | Set company id to fetch posts from |
| `Limit` | Define a limit to restrict the amount of social posts to import (Default: 20) |
| Name | Description |
|--------------|-------------------------------------------------------------------------------|
| `Company ID` | Set company id to fetch posts from |
| `Limit` | Define a limit to restrict the amount of social posts to import (Default: 20) |

## 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
7 changes: 2 additions & 5 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Upgrade Notes

## 2.0.1
- [BUGFIX] fix assoc array check [#3](https://github.com/dachcom-digital/pimcore-social-data-linkedin-connector/pull/3)
-
## Migrating from Version 1.x to Version 2.0.0
## Migrating from Version 2.x to Version 3.0.0

### Global Changes
- PHP8 return type declarations added: you may have to adjust your extensions accordingly
- Recommended folder structure by symfony adopted
9 changes: 5 additions & 4 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
namespace: DachcomBundle\Test
support_namespace: Support
actor: Tester
paths:
tests: tests
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
output: tests/_output
log: tests/_output/var/logs
data: tests/_data
support: tests/Support
bootstrap: _bootstrap.php
settings:
bootstrap: _bootstrap.php
memory_limit: -1
colors: true
params:
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
}
},
"require": {
"dachcom-digital/social-data": "^2.0"
"dachcom-digital/social-data": "^3.0"
},
"require-dev": {
"codeception/codeception": "^4.1",
"codeception/module-webdriver": "^1.4",
"codeception/module-symfony": "^1.6",
"codeception/codeception": "^5.0",
"codeception/module-symfony": "^3.1",
"codeception/module-webdriver": "^4.0",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-symfony": "^1.0",
"symplify/easy-coding-standard": "^9.0"
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions src/Resources/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\LinkedIn\Controller\Admin\LinkedInController:
tags: [ 'controller.service_arguments' ]

## Events

SocialData\Connector\LinkedIn\EventListener\Admin\AssetListener:
tags:
- { name: kernel.event_subscriber }
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ parameters:
symfony:
container_xml_path: %currentWorkingDirectory%/var/cache/test/TestKernelTestDebugContainer.xml
constant_hassers: false
excludes_analyse: []
excludePaths: []
ignoreErrors: []
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/Controller/Admin/LinkedInController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace SocialData\Connector\LinkedIn\Controller\Admin;

use Carbon\Carbon;
use Pimcore\Bundle\AdminBundle\Controller\AdminController;
use Pimcore\Bundle\AdminBundle\Controller\AdminAbstractController;
use SocialData\Connector\LinkedIn\Model\EngineConfiguration;
use SocialData\Connector\LinkedIn\Client\LinkedInClient;
use SocialDataBundle\Connector\ConnectorDefinitionInterface;
Expand All @@ -15,7 +15,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;

class LinkedInController extends AdminController
class LinkedInController extends AdminAbstractController
{
use ConnectResponseTrait;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function load(array $configs, ContainerBuilder $container): void
$configuration = new Configuration();
$this->processConfiguration($configuration, $configs);

$loader = new YamlFileLoader($container, new FileLocator([__DIR__ . '/../Resources/config']));
$loader->load('services.yml');
$loader = new YamlFileLoader($container, new FileLocator([__DIR__ . '/../../config']));
$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\LinkedIn\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/socialdatalinkedinconnector/css/admin.css'
]);
}

public function addJsFiles(PathsEvent $event): void
{
$event->addPaths([
'/bundles/socialdatalinkedinconnector/js/connector/linkedin-connector.js',
'/bundles/socialdatalinkedinconnector/js/feed/linkedin-feed.js',
]);
}
}
22 changes: 6 additions & 16 deletions src/SocialDataLinkedInConnectorBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,22 @@

namespace SocialData\Connector\LinkedIn;

use Pimcore\Extension\Bundle\AbstractPimcoreBundle;
use Pimcore\Extension\Bundle\Traits\PackageVersionTrait;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class SocialDataLinkedInConnectorBundle extends AbstractPimcoreBundle
class SocialDataLinkedInConnectorBundle extends Bundle
{
use PackageVersionTrait;

public const PACKAGE_NAME = 'dachcom-digital/social-data-linkedin-connector';

protected function getComposerPackageName(): string
public function getPath(): string
{
return self::PACKAGE_NAME;
return \dirname(__DIR__);
}

public function getCssPaths(): array
{
return [
'/bundles/socialdatalinkedinconnector/css/admin.css'
];
}

public function getJsPaths(): array
protected function getComposerPackageName(): string
{
return [
'/bundles/socialdatalinkedinconnector/js/connector/linkedin-connector.js',
'/bundles/socialdatalinkedinconnector/js/feed/linkedin-feed.js',
];
return self::PACKAGE_NAME;
}
}
12 changes: 12 additions & 0 deletions tests/Functional.suite.dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
actor: FunctionalTester
modules:
enabled:
- \Dachcom\Codeception\Support\Helper\PimcoreCore:
connect_db: true
rebootable_client: true
- \Dachcom\Codeception\Support\Helper\PimcoreBundleCore:
run_installer: true
- \Dachcom\Codeception\Support\Helper\Browser\PhpBrowser:
depends: \Dachcom\Codeception\Support\Helper\PimcoreCore
- \Dachcom\Codeception\Support\Helper\PimcoreBackend
- \Dachcom\Codeception\Support\Helper\PimcoreUser
File renamed without changes.
Loading

0 comments on commit 0d439fa

Please sign in to comment.