diff --git a/.github/workflows/codeception.yml b/.github/workflows/codeception.yml index 94d392a..e289ed7 100644 --- a/.github/workflows/codeception.yml +++ b/.github/workflows/codeception.yml @@ -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 @@ -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: @@ -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: | diff --git a/.github/workflows/ecs.yml b/.github/workflows/ecs.yml index 00a97c4..ad3dd29 100644 --- a/.github/workflows/ecs.yml +++ b/.github/workflows/ecs.yml @@ -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:root@127.0.0.1:3306/dachcom_bundle_test" @@ -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: @@ -114,4 +114,4 @@ jobs: continue-on-error: true run: | bin/console cache:warmup --env=test - vendor/bin/ecs check ${{ github.workspace }}/lib/test-bundle/src/SocialDataBundle --config ${{ github.workspace }}/lib/test-bundle/ecs.php \ No newline at end of file + vendor/bin/ecs check ${{ github.workspace }}/lib/test-bundle/src --config ${{ github.workspace }}/lib/test-bundle/ecs.php \ No newline at end of file diff --git a/.github/workflows/php-stan.yml b/.github/workflows/php-stan.yml index 8fcf7e8..0abec2d 100644 --- a/.github/workflows/php-stan.yml +++ b/.github/workflows/php-stan.yml @@ -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:root@127.0.0.1:3306/dachcom_bundle_test" @@ -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: diff --git a/.gitignore b/.gitignore index 0139f99..1dedc83 100644 --- a/.gitignore +++ b/.gitignore @@ -52,4 +52,4 @@ php-cgi.core /tests/_output/* /tests/_data/* !/tests/_data/.gitkeep -/tests/_support/_generated/* \ No newline at end of file +/tests/Support/_generated/* \ No newline at end of file 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 dff1f73..141d347 100644 --- a/README.md +++ b/README.md @@ -12,18 +12,25 @@ This Bundles allows you to load social data from different networks like Faceboo ### 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/tree/2.x) | | **1.x** | `6.0` - `6.9` | `3.4`, `^4.4` | 27.04.2020 | Unsupported | [1.x](https://github.com/dachcom-digital/pimcore-social-data/tree/1.x) | ## Installation ```json "require" : { - "dachcom-digital/social-data" : "~2.0.0", + "dachcom-digital/social-data" : "~3.0.0", } ``` -- Execute: `$ bin/console pimcore:bundle:enable SocialDataBundle` +Add Bundle to `bundles.php`: +```php +return [ + SocialDataBundle\SocialDataBundle::class => ['all' => true], +]; +``` + - Execute: `$ bin/console pimcore:bundle:install SocialDataBundle` ## Upgrading diff --git a/UPGRADE.md b/UPGRADE.md index d93c5d4..857c4ae 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,7 +1,6 @@ # Upgrade Notes -## 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 -- Re-save `SocialPost` data object to add/update type declarations \ No newline at end of file +- Recommended folder structure by symfony adopted \ No newline at end of file diff --git a/codeception.dist.yml b/codeception.dist.yml index 882426c..296aad2 100644 --- a/codeception.dist.yml +++ b/codeception.dist.yml @@ -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: diff --git a/composer.json b/composer.json index 50bb000..bf164b6 100755 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ ], "autoload": { "psr-4": { - "SocialDataBundle\\": "src/SocialDataBundle" + "SocialDataBundle\\": "src/" } }, "autoload-dev": { @@ -30,17 +30,18 @@ ] }, "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "3.x-dev" } }, "require": { - "pimcore/pimcore": "^10.1", + "pimcore/pimcore": "^11.0", + "symfony/form": "^6.2", "doctrine/orm": "^2.7" }, "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" diff --git a/src/SocialDataBundle/Resources/config/doctrine/model/ConnectorEngine.orm.yml b/config/doctrine/model/ConnectorEngine.orm.yml similarity index 100% rename from src/SocialDataBundle/Resources/config/doctrine/model/ConnectorEngine.orm.yml rename to config/doctrine/model/ConnectorEngine.orm.yml diff --git a/src/SocialDataBundle/Resources/config/doctrine/model/Feed.orm.yml b/config/doctrine/model/Feed.orm.yml similarity index 100% rename from src/SocialDataBundle/Resources/config/doctrine/model/Feed.orm.yml rename to config/doctrine/model/Feed.orm.yml diff --git a/src/SocialDataBundle/Resources/config/doctrine/model/LogEntry.orm.yml b/config/doctrine/model/LogEntry.orm.yml similarity index 100% rename from src/SocialDataBundle/Resources/config/doctrine/model/LogEntry.orm.yml rename to config/doctrine/model/LogEntry.orm.yml diff --git a/src/SocialDataBundle/Resources/config/doctrine/model/Tag.orm.yml b/config/doctrine/model/Tag.orm.yml similarity index 100% rename from src/SocialDataBundle/Resources/config/doctrine/model/Tag.orm.yml rename to config/doctrine/model/Tag.orm.yml diff --git a/src/SocialDataBundle/Resources/config/doctrine/model/Wall.orm.yml b/config/doctrine/model/Wall.orm.yml similarity index 100% rename from src/SocialDataBundle/Resources/config/doctrine/model/Wall.orm.yml rename to config/doctrine/model/Wall.orm.yml diff --git a/src/SocialDataBundle/Resources/install/class/SocialPost.class.json b/config/install/class/SocialPost.class.json similarity index 99% rename from src/SocialDataBundle/Resources/install/class/SocialPost.class.json rename to config/install/class/SocialPost.class.json index 0f4a53c..3b7d89c 100644 --- a/src/SocialDataBundle/Resources/install/class/SocialPost.class.json +++ b/config/install/class/SocialPost.class.json @@ -24,7 +24,7 @@ "bodyStyle": null, "datatype": "layout", "permissions": null, - "childs": [ + "children": [ { "fieldtype": "panel", "labelWidth": 100, @@ -41,7 +41,7 @@ "bodyStyle": "", "datatype": "layout", "permissions": null, - "childs": [ + "children": [ { "fieldtype": "input", "width": null, @@ -166,7 +166,7 @@ "bodyStyle": "", "datatype": "layout", "permissions": null, - "childs": [ + "children": [ { "fieldtype": "textarea", "width": 250, diff --git a/src/SocialDataBundle/Resources/install/sql/install.sql b/config/install/sql/install.sql similarity index 100% rename from src/SocialDataBundle/Resources/install/sql/install.sql rename to config/install/sql/install.sql diff --git a/src/SocialDataBundle/Resources/install/translations/admin.csv b/config/install/translations/admin.csv similarity index 100% rename from src/SocialDataBundle/Resources/install/translations/admin.csv rename to config/install/translations/admin.csv diff --git a/src/SocialDataBundle/Resources/config/pimcore/config.yml b/config/pimcore/config.yaml similarity index 87% rename from src/SocialDataBundle/Resources/config/pimcore/config.yml rename to config/pimcore/config.yaml index 3ca803c..9beebb9 100644 --- a/src/SocialDataBundle/Resources/config/pimcore/config.yml +++ b/config/pimcore/config.yaml @@ -1,3 +1,7 @@ +doctrine_migrations: + migrations_paths: + 'SocialDataBundle\Migrations': '@SocialDataBundle/src/Migrations' + doctrine: orm: auto_generate_proxy_classes: '%kernel.debug%' diff --git a/src/SocialDataBundle/Resources/config/pimcore/routing.yml b/config/pimcore/routing.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/pimcore/routing.yml rename to config/pimcore/routing.yaml diff --git a/src/SocialDataBundle/Resources/config/serialization/ConnectorEngine.yml b/config/serialization/ConnectorEngine.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/serialization/ConnectorEngine.yml rename to config/serialization/ConnectorEngine.yaml diff --git a/src/SocialDataBundle/Resources/config/serialization/Feed.yml b/config/serialization/Feed.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/serialization/Feed.yml rename to config/serialization/Feed.yaml diff --git a/src/SocialDataBundle/Resources/config/serialization/Tag.yml b/config/serialization/Tag.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/serialization/Tag.yml rename to config/serialization/Tag.yaml diff --git a/config/services.yaml b/config/services.yaml new file mode 100644 index 0000000..ee78c90 --- /dev/null +++ b/config/services.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: services/*.yaml } \ No newline at end of file diff --git a/src/SocialDataBundle/Resources/config/services/builder.yml b/config/services/builder.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/services/builder.yml rename to config/services/builder.yaml diff --git a/src/SocialDataBundle/Resources/config/services/command.yml b/config/services/command.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/services/command.yml rename to config/services/command.yaml diff --git a/src/SocialDataBundle/Resources/config/services/controller.yml b/config/services/controller.yaml similarity index 70% rename from src/SocialDataBundle/Resources/config/services/controller.yml rename to config/services/controller.yaml index da5a163..804a1b8 100644 --- a/src/SocialDataBundle/Resources/config/services/controller.yml +++ b/config/services/controller.yaml @@ -6,7 +6,7 @@ services: public: true SocialDataBundle\Controller\: - resource: '../../Controller' + resource: '../../src/Controller' public: true autowire: true autoconfigure: true diff --git a/src/SocialDataBundle/Resources/config/services/eventlistener.yml b/config/services/eventlistener.yaml similarity index 63% rename from src/SocialDataBundle/Resources/config/services/eventlistener.yml rename to config/services/eventlistener.yaml index 31fc2a7..ed2b098 100644 --- a/src/SocialDataBundle/Resources/config/services/eventlistener.yml +++ b/config/services/eventlistener.yaml @@ -5,6 +5,10 @@ services: autoconfigure: true public: false + SocialDataBundle\EventListener\Admin\AssetListener: + tags: + - { name: kernel.event_subscriber } + SocialDataBundle\EventListener\FeedPostListener: tags: - { name: kernel.event_subscriber } diff --git a/src/SocialDataBundle/Resources/config/services/factory.yml b/config/services/factory.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/services/factory.yml rename to config/services/factory.yaml diff --git a/src/SocialDataBundle/Resources/config/services/form.yml b/config/services/form.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/services/form.yml rename to config/services/form.yaml diff --git a/src/SocialDataBundle/Resources/config/services/install.yml b/config/services/install.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/services/install.yml rename to config/services/install.yaml diff --git a/src/SocialDataBundle/Resources/config/services/logging.yml b/config/services/logging.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/services/logging.yml rename to config/services/logging.yaml diff --git a/src/SocialDataBundle/Resources/config/services/maintenance.yml b/config/services/maintenance.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/services/maintenance.yml rename to config/services/maintenance.yaml diff --git a/src/SocialDataBundle/Resources/config/services/manager.yml b/config/services/manager.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/services/manager.yml rename to config/services/manager.yaml diff --git a/src/SocialDataBundle/Resources/config/services/processor.yml b/config/services/processor.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/services/processor.yml rename to config/services/processor.yaml diff --git a/src/SocialDataBundle/Resources/config/services/registry.yml b/config/services/registry.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/services/registry.yml rename to config/services/registry.yaml diff --git a/src/SocialDataBundle/Resources/config/services/repository.yml b/config/services/repository.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/services/repository.yml rename to config/services/repository.yaml diff --git a/src/SocialDataBundle/Resources/config/services/services.yml b/config/services/services.yaml similarity index 100% rename from src/SocialDataBundle/Resources/config/services/services.yml rename to config/services/services.yaml diff --git a/phpstan.neon b/phpstan.neon index 5980ad2..8a06ff8 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -7,5 +7,5 @@ parameters: symfony: container_xml_path: %currentWorkingDirectory%/var/cache/test/TestKernelTestDebugContainer.xml constant_hassers: false - excludes_analyse: [] + excludePaths: [] ignoreErrors: [] diff --git a/src/SocialDataBundle/Resources/public/css/admin.css b/public/css/admin.css similarity index 100% rename from src/SocialDataBundle/Resources/public/css/admin.css rename to public/css/admin.css diff --git a/src/SocialDataBundle/Resources/public/img/social_data_icon_settings_white.svg b/public/img/social_data_icon_settings_white.svg similarity index 100% rename from src/SocialDataBundle/Resources/public/img/social_data_icon_settings_white.svg rename to public/img/social_data_icon_settings_white.svg diff --git a/src/SocialDataBundle/Resources/public/img/social_data_icon_wall_white.svg b/public/img/social_data_icon_wall_white.svg similarity index 100% rename from src/SocialDataBundle/Resources/public/img/social_data_icon_wall_white.svg rename to public/img/social_data_icon_wall_white.svg diff --git a/src/SocialDataBundle/Resources/public/img/social_data_icon_white.svg b/public/img/social_data_icon_white.svg similarity index 100% rename from src/SocialDataBundle/Resources/public/img/social_data_icon_white.svg rename to public/img/social_data_icon_white.svg diff --git a/src/SocialDataBundle/Resources/public/img/social_data_wall.svg b/public/img/social_data_wall.svg similarity index 100% rename from src/SocialDataBundle/Resources/public/img/social_data_wall.svg rename to public/img/social_data_wall.svg diff --git a/src/SocialDataBundle/Resources/public/img/social_data_wall_add.svg b/public/img/social_data_wall_add.svg similarity index 100% rename from src/SocialDataBundle/Resources/public/img/social_data_wall_add.svg rename to public/img/social_data_wall_add.svg diff --git a/src/SocialDataBundle/Resources/public/img/social_data_wall_feed.svg b/public/img/social_data_wall_feed.svg similarity index 100% rename from src/SocialDataBundle/Resources/public/img/social_data_wall_feed.svg rename to public/img/social_data_wall_feed.svg diff --git a/src/SocialDataBundle/Resources/public/img/social_data_wall_feed_add.svg b/public/img/social_data_wall_feed_add.svg similarity index 100% rename from src/SocialDataBundle/Resources/public/img/social_data_wall_feed_add.svg rename to public/img/social_data_wall_feed_add.svg diff --git a/src/SocialDataBundle/Resources/public/js/component/connectWindow.js b/public/js/component/connectWindow.js similarity index 100% rename from src/SocialDataBundle/Resources/public/js/component/connectWindow.js rename to public/js/component/connectWindow.js diff --git a/src/SocialDataBundle/Resources/public/js/component/relation.js b/public/js/component/relation.js similarity index 100% rename from src/SocialDataBundle/Resources/public/js/component/relation.js rename to public/js/component/relation.js diff --git a/src/SocialDataBundle/Resources/public/js/component/relationTextField.js b/public/js/component/relationTextField.js similarity index 100% rename from src/SocialDataBundle/Resources/public/js/component/relationTextField.js rename to public/js/component/relationTextField.js diff --git a/src/SocialDataBundle/Resources/public/js/connector/abstract-connector.js b/public/js/connector/abstract-connector.js similarity index 100% rename from src/SocialDataBundle/Resources/public/js/connector/abstract-connector.js rename to public/js/connector/abstract-connector.js diff --git a/src/SocialDataBundle/Resources/public/js/feed/abstract-feed.js b/public/js/feed/abstract-feed.js similarity index 100% rename from src/SocialDataBundle/Resources/public/js/feed/abstract-feed.js rename to public/js/feed/abstract-feed.js diff --git a/src/SocialDataBundle/Resources/public/js/plugin.js b/public/js/plugin.js similarity index 64% rename from src/SocialDataBundle/Resources/public/js/plugin.js rename to public/js/plugin.js index b534ea0..5912408 100755 --- a/src/SocialDataBundle/Resources/public/js/plugin.js +++ b/public/js/plugin.js @@ -1,34 +1,27 @@ -pimcore.registerNS('pimcore.plugin.SocialData'); +class SocialDataCore { -pimcore.plugin.SocialData = Class.create(pimcore.plugin.admin, { + constructor() { - getClassName: function () { - return 'pimcore.plugin.SocialData'; - }, + if (String.prototype.format) { + return; + } - initialize: function () { - pimcore.plugin.broker.registerPlugin(this); + String.prototype.format = function () { - if (!String.prototype.format) { - String.prototype.format = function () { - var args = arguments; - return this.replace(/{(\d+)}/g, function (match, number) { - return typeof args[number] != 'undefined' - ? args[number] - : match - ; - }); - }; - } - }, + let args = arguments; - uninstall: function () { - // void - }, + return this.replace(/{(\d+)}/g, function (match, number) { + return typeof args[number] != 'undefined' + ? args[number] + : match + ; + }); + }; + } - pimcoreReady: function (params, broker) { + init() { - var subMenu = [], + let subMenu = [], user = pimcore.globalmanager.get('user'); if (user.isAllowed('social_data_bundle_menu_settings')) { @@ -61,24 +54,25 @@ pimcore.plugin.SocialData = Class.create(pimcore.plugin.admin, { } }); } - }, + } - openSettingsPanel: function () { + openSettingsPanel() { try { pimcore.globalmanager.get('social_data_bundle_settings').activate(); } catch (e) { pimcore.globalmanager.add('social_data_bundle_settings', new SocialData.SettingsPanel()); } - }, + } - openWallsPanel: function () { + openWallsPanel() { try { pimcore.globalmanager.get('social_data_bundle_walls').activate(); } catch (e) { pimcore.globalmanager.add('social_data_bundle_walls', new SocialData.WallsPanel()); } } +} -}); +const socialDataCoreHandler = new SocialDataCore(); -new pimcore.plugin.SocialData(); +document.addEventListener(pimcore.events.pimcoreReady, socialDataCoreHandler.init.bind(socialDataCoreHandler)); diff --git a/src/SocialDataBundle/Resources/public/js/settingsPanel.js b/public/js/settingsPanel.js similarity index 100% rename from src/SocialDataBundle/Resources/public/js/settingsPanel.js rename to public/js/settingsPanel.js diff --git a/src/SocialDataBundle/Resources/public/js/vendor/dataObject.js b/public/js/vendor/dataObject.js similarity index 100% rename from src/SocialDataBundle/Resources/public/js/vendor/dataObject.js rename to public/js/vendor/dataObject.js diff --git a/src/SocialDataBundle/Resources/public/js/wall/mainPanel.js b/public/js/wall/mainPanel.js similarity index 100% rename from src/SocialDataBundle/Resources/public/js/wall/mainPanel.js rename to public/js/wall/mainPanel.js diff --git a/src/SocialDataBundle/Resources/public/js/wallsPanel.js b/public/js/wallsPanel.js similarity index 100% rename from src/SocialDataBundle/Resources/public/js/wallsPanel.js rename to public/js/wallsPanel.js diff --git a/src/SocialDataBundle/Builder/ExtJsDataBuilder.php b/src/Builder/ExtJsDataBuilder.php similarity index 100% rename from src/SocialDataBundle/Builder/ExtJsDataBuilder.php rename to src/Builder/ExtJsDataBuilder.php diff --git a/src/SocialDataBundle/Command/FetchSocialPostsCommand.php b/src/Command/FetchSocialPostsCommand.php similarity index 81% rename from src/SocialDataBundle/Command/FetchSocialPostsCommand.php rename to src/Command/FetchSocialPostsCommand.php index 5fe2b6b..c064b3c 100644 --- a/src/SocialDataBundle/Command/FetchSocialPostsCommand.php +++ b/src/Command/FetchSocialPostsCommand.php @@ -13,12 +13,8 @@ class FetchSocialPostsCommand extends Command protected static $defaultName = 'social-data:fetch:social-posts'; protected static $defaultDescription = 'Fetch Social Posts'; - protected SocialPostBuilderProcessor $socialPostBuilderProcessor; - - public function __construct(SocialPostBuilderProcessor $socialPostBuilderProcessor) + public function __construct(protected SocialPostBuilderProcessor $socialPostBuilderProcessor) { - $this->socialPostBuilderProcessor = $socialPostBuilderProcessor; - parent::__construct(); } diff --git a/src/SocialDataBundle/Connector/ConnectorDefinitionInterface.php b/src/Connector/ConnectorDefinitionInterface.php similarity index 100% rename from src/SocialDataBundle/Connector/ConnectorDefinitionInterface.php rename to src/Connector/ConnectorDefinitionInterface.php diff --git a/src/SocialDataBundle/Connector/ConnectorEngineConfigurationInterface.php b/src/Connector/ConnectorEngineConfigurationInterface.php similarity index 100% rename from src/SocialDataBundle/Connector/ConnectorEngineConfigurationInterface.php rename to src/Connector/ConnectorEngineConfigurationInterface.php diff --git a/src/SocialDataBundle/Connector/ConnectorFeedConfigurationInterface.php b/src/Connector/ConnectorFeedConfigurationInterface.php similarity index 100% rename from src/SocialDataBundle/Connector/ConnectorFeedConfigurationInterface.php rename to src/Connector/ConnectorFeedConfigurationInterface.php diff --git a/src/SocialDataBundle/Connector/SocialPostBuilderInterface.php b/src/Connector/SocialPostBuilderInterface.php similarity index 100% rename from src/SocialDataBundle/Connector/SocialPostBuilderInterface.php rename to src/Connector/SocialPostBuilderInterface.php diff --git a/src/SocialDataBundle/Controller/Admin/LogController.php b/src/Controller/Admin/LogController.php similarity index 89% rename from src/SocialDataBundle/Controller/Admin/LogController.php rename to src/Controller/Admin/LogController.php index da4b5ba..161f49d 100644 --- a/src/SocialDataBundle/Controller/Admin/LogController.php +++ b/src/Controller/Admin/LogController.php @@ -2,18 +2,15 @@ namespace SocialDataBundle\Controller\Admin; +use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use SocialDataBundle\Manager\LogManagerInterface; -use Pimcore\Bundle\AdminBundle\HttpFoundation\JsonResponse; -use Pimcore\Bundle\AdminBundle\Controller\AdminController; +use Pimcore\Bundle\AdminBundle\Controller\AdminAbstractController; -class LogController extends AdminController +class LogController extends AdminAbstractController { - protected LogManagerInterface $logManager; - - public function __construct(LogManagerInterface $logManager) + public function __construct(protected LogManagerInterface $logManager) { - $this->logManager = $logManager; } public function loadLogsForConnectorAction(Request $request, int $connectorEngineId): JsonResponse diff --git a/src/SocialDataBundle/Controller/Admin/SettingsController.php b/src/Controller/Admin/SettingsController.php similarity index 84% rename from src/SocialDataBundle/Controller/Admin/SettingsController.php rename to src/Controller/Admin/SettingsController.php index ca05338..adcb2b3 100644 --- a/src/SocialDataBundle/Controller/Admin/SettingsController.php +++ b/src/Controller/Admin/SettingsController.php @@ -10,34 +10,20 @@ use SocialDataBundle\Model\SocialPostInterface; use SocialDataBundle\Registry\ConnectorDefinitionRegistryInterface; use Symfony\Component\Form\FormFactoryInterface; +use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; -use Pimcore\Bundle\AdminBundle\HttpFoundation\JsonResponse; -use Pimcore\Bundle\AdminBundle\Controller\AdminController; +use Pimcore\Bundle\AdminBundle\Controller\AdminAbstractController; -class SettingsController extends AdminController +class SettingsController extends AdminAbstractController { - protected FormFactoryInterface $formFactory; - protected EnvironmentServiceInterface $environmentService; - protected ConnectorManagerInterface $connectorManager; - protected ConnectorDefinitionRegistryInterface $connectorRegistry; - protected ConnectorServiceInterface $connectorService; - protected ExtJsDataBuilder $extJsDataBuilder; - public function __construct( - - FormFactoryInterface $formFactory, - EnvironmentServiceInterface $environmentService, - ConnectorManagerInterface $connectorManager, - ConnectorDefinitionRegistryInterface $connectorRegistry, - ConnectorServiceInterface $connectorService, - ExtJsDataBuilder $extJsDataBuilder + protected FormFactoryInterface $formFactory, + protected EnvironmentServiceInterface $environmentService, + protected ConnectorManagerInterface $connectorManager, + protected ConnectorDefinitionRegistryInterface $connectorRegistry, + protected ConnectorServiceInterface $connectorService, + protected ExtJsDataBuilder $extJsDataBuilder ) { - $this->formFactory = $formFactory; - $this->environmentService = $environmentService; - $this->connectorManager = $connectorManager; - $this->connectorRegistry = $connectorRegistry; - $this->connectorService = $connectorService; - $this->extJsDataBuilder = $extJsDataBuilder; } /** diff --git a/src/SocialDataBundle/Controller/Admin/Traits/ConnectResponseTrait.php b/src/Controller/Admin/Traits/ConnectResponseTrait.php similarity index 100% rename from src/SocialDataBundle/Controller/Admin/Traits/ConnectResponseTrait.php rename to src/Controller/Admin/Traits/ConnectResponseTrait.php diff --git a/src/SocialDataBundle/Controller/Admin/WallsController.php b/src/Controller/Admin/WallsController.php similarity index 88% rename from src/SocialDataBundle/Controller/Admin/WallsController.php rename to src/Controller/Admin/WallsController.php index b1838e0..5627a3b 100644 --- a/src/SocialDataBundle/Controller/Admin/WallsController.php +++ b/src/Controller/Admin/WallsController.php @@ -10,31 +10,20 @@ use SocialDataBundle\Manager\WallManagerInterface; use SocialDataBundle\Service\LockServiceInterface; use Symfony\Component\Form\FormFactoryInterface; +use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; -use Pimcore\Bundle\AdminBundle\HttpFoundation\JsonResponse; -use Pimcore\Bundle\AdminBundle\Controller\AdminController; +use Pimcore\Bundle\AdminBundle\Controller\AdminAbstractController; use SocialDataBundle\Model\WallInterface; -class WallsController extends AdminController +class WallsController extends AdminAbstractController { - protected LockServiceInterface $lockService; - protected LoggerInterface $logger; - protected FormFactoryInterface $formFactory; - protected WallManagerInterface $wallManager; - protected ExtJsDataBuilder $extJsDataBuilder; - public function __construct( - LockServiceInterface $lockService, - LoggerInterface $logger, - FormFactoryInterface $formFactory, - WallManagerInterface $wallManager, - ExtJsDataBuilder $extJsDataBuilder + protected LockServiceInterface $lockService, + protected LoggerInterface $logger, + protected FormFactoryInterface $formFactory, + protected WallManagerInterface $wallManager, + protected ExtJsDataBuilder $extJsDataBuilder ) { - $this->lockService = $lockService; - $this->logger = $logger; - $this->formFactory = $formFactory; - $this->wallManager = $wallManager; - $this->extJsDataBuilder = $extJsDataBuilder; } public function fetchAllWallsAction(): JsonResponse diff --git a/src/SocialDataBundle/DependencyInjection/Compiler/ConnectorDefinitionPass.php b/src/DependencyInjection/Compiler/ConnectorDefinitionPass.php similarity index 100% rename from src/SocialDataBundle/DependencyInjection/Compiler/ConnectorDefinitionPass.php rename to src/DependencyInjection/Compiler/ConnectorDefinitionPass.php diff --git a/src/SocialDataBundle/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php similarity index 100% rename from src/SocialDataBundle/DependencyInjection/Configuration.php rename to src/DependencyInjection/Configuration.php diff --git a/src/SocialDataBundle/DependencyInjection/SocialDataExtension.php b/src/DependencyInjection/SocialDataExtension.php similarity index 97% rename from src/SocialDataBundle/DependencyInjection/SocialDataExtension.php rename to src/DependencyInjection/SocialDataExtension.php index b178cb9..115c249 100644 --- a/src/SocialDataBundle/DependencyInjection/SocialDataExtension.php +++ b/src/DependencyInjection/SocialDataExtension.php @@ -18,8 +18,8 @@ public function load(array $configs, ContainerBuilder $container): void $configuration = new Configuration(); $config = $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'); $persistenceConfig = $config['persistence']['doctrine']; $entityManagerName = $persistenceConfig['entity_manager']; diff --git a/src/SocialDataBundle/Dto/AbstractData.php b/src/Dto/AbstractData.php similarity index 73% rename from src/SocialDataBundle/Dto/AbstractData.php rename to src/Dto/AbstractData.php index a1698c0..eb16459 100644 --- a/src/SocialDataBundle/Dto/AbstractData.php +++ b/src/Dto/AbstractData.php @@ -4,14 +4,12 @@ abstract class AbstractData { - protected BuildConfig $buildConfig; - protected array $options; protected mixed $transferredData = null; - public function __construct(BuildConfig $buildConfig, array $options) - { - $this->buildConfig = $buildConfig; - $this->options = $options; + public function __construct( + protected BuildConfig $buildConfig, + protected array $options + ) { } /** diff --git a/src/SocialDataBundle/Dto/BuildConfig.php b/src/Dto/BuildConfig.php similarity index 67% rename from src/SocialDataBundle/Dto/BuildConfig.php rename to src/Dto/BuildConfig.php index be68fae..5addd39 100644 --- a/src/SocialDataBundle/Dto/BuildConfig.php +++ b/src/Dto/BuildConfig.php @@ -9,18 +9,11 @@ class BuildConfig { - protected FeedInterface $feed; - protected ConnectorEngineConfigurationInterface $engineConfiguration; - protected array $definitionConfiguration; - public function __construct( - FeedInterface $feed, - ConnectorEngineConfigurationInterface $engineConfiguration, - array $definitionConfiguration + protected FeedInterface $feed, + protected ConnectorEngineConfigurationInterface $engineConfiguration, + protected array $definitionConfiguration ) { - $this->feed = $feed; - $this->engineConfiguration = $engineConfiguration; - $this->definitionConfiguration = $definitionConfiguration; } public function getEngineConfiguration(): ConnectorEngineConfigurationInterface diff --git a/src/SocialDataBundle/Dto/FetchData.php b/src/Dto/FetchData.php similarity index 100% rename from src/SocialDataBundle/Dto/FetchData.php rename to src/Dto/FetchData.php diff --git a/src/SocialDataBundle/Dto/FilterData.php b/src/Dto/FilterData.php similarity index 100% rename from src/SocialDataBundle/Dto/FilterData.php rename to src/Dto/FilterData.php diff --git a/src/SocialDataBundle/Dto/TransformData.php b/src/Dto/TransformData.php similarity index 100% rename from src/SocialDataBundle/Dto/TransformData.php rename to src/Dto/TransformData.php diff --git a/src/SocialDataBundle/Event/SocialPostBuildConfigureEvent.php b/src/Event/SocialPostBuildConfigureEvent.php similarity index 100% rename from src/SocialDataBundle/Event/SocialPostBuildConfigureEvent.php rename to src/Event/SocialPostBuildConfigureEvent.php diff --git a/src/SocialDataBundle/Event/SocialPostBuildEvent.php b/src/Event/SocialPostBuildEvent.php similarity index 61% rename from src/SocialDataBundle/Event/SocialPostBuildEvent.php rename to src/Event/SocialPostBuildEvent.php index 234c8ef..6ecfc49 100644 --- a/src/SocialDataBundle/Event/SocialPostBuildEvent.php +++ b/src/Event/SocialPostBuildEvent.php @@ -7,13 +7,10 @@ class SocialPostBuildEvent extends Event { - protected string $connectorName; - protected AbstractData $data; - - public function __construct(string $connectorName, AbstractData $data) - { - $this->connectorName = $connectorName; - $this->data = $data; + public function __construct( + protected string $connectorName, + protected AbstractData $data + ) { } public function getConnectorName(): string diff --git a/src/EventListener/Admin/AssetListener.php b/src/EventListener/Admin/AssetListener.php new file mode 100644 index 0000000..b1f3d2e --- /dev/null +++ b/src/EventListener/Admin/AssetListener.php @@ -0,0 +1,41 @@ + 'addCssFiles', + BundleManagerEvents::JS_PATHS => 'addJsFiles', + ]; + } + + public function addCssFiles(PathsEvent $event): void + { + $event->addPaths([ + '/bundles/socialdata/css/admin.css' + ]); + } + + public function addJsFiles(PathsEvent $event): void + { + $event->addPaths([ + '/bundles/socialdata/js/component/relation.js', + '/bundles/socialdata/js/component/relationTextField.js', + '/bundles/socialdata/js/component/connectWindow.js', + '/bundles/socialdata/js/plugin.js', + '/bundles/socialdata/js/settingsPanel.js', + '/bundles/socialdata/js/wallsPanel.js', + '/bundles/socialdata/js/wall/mainPanel.js', + '/bundles/socialdata/js/connector/abstract-connector.js', + '/bundles/socialdata/js/feed/abstract-feed.js', + '/bundles/socialdata/js/vendor/dataObject.js', + ]); + } +} diff --git a/src/SocialDataBundle/EventListener/EntityDeletionListener.php b/src/EventListener/EntityDeletionListener.php similarity index 89% rename from src/SocialDataBundle/EventListener/EntityDeletionListener.php rename to src/EventListener/EntityDeletionListener.php index 5c22055..93c7a77 100644 --- a/src/SocialDataBundle/EventListener/EntityDeletionListener.php +++ b/src/EventListener/EntityDeletionListener.php @@ -6,18 +6,15 @@ use Doctrine\ORM\Event\OnFlushEventArgs; use Doctrine\ORM\Events; use Doctrine\Common\EventSubscriber; -use Pimcore\Bundle\AdminBundle\Security\User\TokenStorageUserResolver; +use Pimcore\Security\User\TokenStorageUserResolver; use SocialDataBundle\Model\FeedInterface; use SocialDataBundle\Model\LogEntry; use SocialDataBundle\Model\WallInterface; class EntityDeletionListener implements EventSubscriber { - protected TokenStorageUserResolver $userResolver; - - public function __construct(TokenStorageUserResolver $userResolver) + public function __construct(protected TokenStorageUserResolver $userResolver) { - $this->userResolver = $userResolver; } public function getSubscribedEvents(): array diff --git a/src/SocialDataBundle/EventListener/FeedPostListener.php b/src/EventListener/FeedPostListener.php similarity index 84% rename from src/SocialDataBundle/EventListener/FeedPostListener.php rename to src/EventListener/FeedPostListener.php index 1f5e613..eb3b302 100644 --- a/src/SocialDataBundle/EventListener/FeedPostListener.php +++ b/src/EventListener/FeedPostListener.php @@ -11,11 +11,8 @@ class FeedPostListener implements EventSubscriberInterface { - protected FeedPostManager $feedPostManager; - - public function __construct(FeedPostManager $feedPostManager) + public function __construct(protected FeedPostManager $feedPostManager) { - $this->feedPostManager = $feedPostManager; } public static function getSubscribedEvents(): array diff --git a/src/SocialDataBundle/EventListener/Maintenance/CleanUpLogsTask.php b/src/EventListener/Maintenance/CleanUpLogsTask.php similarity index 56% rename from src/SocialDataBundle/EventListener/Maintenance/CleanUpLogsTask.php rename to src/EventListener/Maintenance/CleanUpLogsTask.php index 5990cf3..2c8ee42 100644 --- a/src/SocialDataBundle/EventListener/Maintenance/CleanUpLogsTask.php +++ b/src/EventListener/Maintenance/CleanUpLogsTask.php @@ -7,18 +7,11 @@ class CleanUpLogsTask implements TaskInterface { - protected bool $enabled; - protected int $expirationDays; - protected LogRepositoryInterface $logRepository; - public function __construct( - bool $enabled, - int $expirationDays, - LogRepositoryInterface $logRepository + protected bool $enabled, + protected int $expirationDays, + protected LogRepositoryInterface $logRepository ) { - $this->enabled = $enabled; - $this->expirationDays = $expirationDays; - $this->logRepository = $logRepository; } public function execute(): void diff --git a/src/SocialDataBundle/EventListener/Maintenance/CleanUpOldSocialPostsTask.php b/src/EventListener/Maintenance/CleanUpOldSocialPostsTask.php similarity index 59% rename from src/SocialDataBundle/EventListener/Maintenance/CleanUpOldSocialPostsTask.php rename to src/EventListener/Maintenance/CleanUpOldSocialPostsTask.php index 99dbc9d..d0a6d68 100644 --- a/src/SocialDataBundle/EventListener/Maintenance/CleanUpOldSocialPostsTask.php +++ b/src/EventListener/Maintenance/CleanUpOldSocialPostsTask.php @@ -10,24 +10,13 @@ class CleanUpOldSocialPostsTask implements TaskInterface { public const LOCK_ID = 'social_data_maintenance_task_cleanup_old_social_posts'; - protected bool $enabled; - protected bool $deletePoster; - protected int $expirationDays; - protected LockServiceInterface $lockService; - protected SocialPostRepositoryInterface $socialPostRepository; - public function __construct( - bool $enabled, - bool $deletePoster, - int $expirationDays, - LockServiceInterface $lockService, - SocialPostRepositoryInterface $socialPostRepository + protected bool $enabled, + protected bool $deletePoster, + protected int $expirationDays, + protected LockServiceInterface $lockService, + protected SocialPostRepositoryInterface $socialPostRepository ) { - $this->enabled = $enabled; - $this->deletePoster = $deletePoster; - $this->expirationDays = $expirationDays; - $this->lockService = $lockService; - $this->socialPostRepository = $socialPostRepository; } public function execute(): void diff --git a/src/SocialDataBundle/EventListener/Maintenance/FetchSocialPostsTask.php b/src/EventListener/Maintenance/FetchSocialPostsTask.php similarity index 61% rename from src/SocialDataBundle/EventListener/Maintenance/FetchSocialPostsTask.php rename to src/EventListener/Maintenance/FetchSocialPostsTask.php index dd14d5f..5c8d260 100644 --- a/src/SocialDataBundle/EventListener/Maintenance/FetchSocialPostsTask.php +++ b/src/EventListener/Maintenance/FetchSocialPostsTask.php @@ -10,21 +10,12 @@ class FetchSocialPostsTask implements TaskInterface { public const LOCK_ID = 'social_data_maintenance_task_fetch_social_posts'; - protected bool $enabled; - protected float $interval; - protected LockServiceInterface $lockService; - protected SocialPostBuilderProcessor $socialPostBuilderProcessor; - public function __construct( - bool $enabled, - float $interval, - LockServiceInterface $lockService, - SocialPostBuilderProcessor $socialPostBuilderProcessor + protected bool $enabled, + protected float $interval, + protected LockServiceInterface $lockService, + protected SocialPostBuilderProcessor $socialPostBuilderProcessor ) { - $this->enabled = $enabled; - $this->interval = $interval; - $this->lockService = $lockService; - $this->socialPostBuilderProcessor = $socialPostBuilderProcessor; } public function execute(): void diff --git a/src/SocialDataBundle/Exception/BuildException.php b/src/Exception/BuildException.php similarity index 100% rename from src/SocialDataBundle/Exception/BuildException.php rename to src/Exception/BuildException.php diff --git a/src/SocialDataBundle/Exception/ConnectException.php b/src/Exception/ConnectException.php similarity index 100% rename from src/SocialDataBundle/Exception/ConnectException.php rename to src/Exception/ConnectException.php diff --git a/src/SocialDataBundle/Factory/SocialPostFactory.php b/src/Factory/SocialPostFactory.php similarity index 70% rename from src/SocialDataBundle/Factory/SocialPostFactory.php rename to src/Factory/SocialPostFactory.php index a830378..094070a 100644 --- a/src/SocialDataBundle/Factory/SocialPostFactory.php +++ b/src/Factory/SocialPostFactory.php @@ -7,11 +7,8 @@ class SocialPostFactory implements SocialPostFactoryInterface { - protected EnvironmentService $environmentService; - - public function __construct(EnvironmentService $environmentService) + public function __construct(protected EnvironmentService $environmentService) { - $this->environmentService = $environmentService; } public function create(): SocialPostInterface @@ -20,4 +17,4 @@ public function create(): SocialPostInterface return new $objectClass(); } -} \ No newline at end of file +} diff --git a/src/SocialDataBundle/Factory/SocialPostFactoryInterface.php b/src/Factory/SocialPostFactoryInterface.php similarity index 100% rename from src/SocialDataBundle/Factory/SocialPostFactoryInterface.php rename to src/Factory/SocialPostFactoryInterface.php diff --git a/src/SocialDataBundle/Form/Admin/Type/TagCollectionType.php b/src/Form/Admin/Type/TagCollectionType.php similarity index 100% rename from src/SocialDataBundle/Form/Admin/Type/TagCollectionType.php rename to src/Form/Admin/Type/TagCollectionType.php diff --git a/src/SocialDataBundle/Form/Admin/Type/TagType.php b/src/Form/Admin/Type/TagType.php similarity index 91% rename from src/SocialDataBundle/Form/Admin/Type/TagType.php rename to src/Form/Admin/Type/TagType.php index efbd367..b9b87b9 100644 --- a/src/SocialDataBundle/Form/Admin/Type/TagType.php +++ b/src/Form/Admin/Type/TagType.php @@ -13,11 +13,8 @@ class TagType extends AbstractType { - protected EntityManagerInterface $manager; - - public function __construct(EntityManagerInterface $manager) + public function __construct(protected EntityManagerInterface $manager) { - $this->manager = $manager; } public function buildForm(FormBuilderInterface $builder, array $options): void @@ -62,4 +59,4 @@ public function configureOptions(OptionsResolver $resolver): void 'data_class' => Tag::class ]); } -} \ No newline at end of file +} diff --git a/src/SocialDataBundle/Form/Admin/Type/Wall/Component/ConnectorEngineChoiceType.php b/src/Form/Admin/Type/Wall/Component/ConnectorEngineChoiceType.php similarity index 78% rename from src/SocialDataBundle/Form/Admin/Type/Wall/Component/ConnectorEngineChoiceType.php rename to src/Form/Admin/Type/Wall/Component/ConnectorEngineChoiceType.php index c177a2b..886f400 100644 --- a/src/SocialDataBundle/Form/Admin/Type/Wall/Component/ConnectorEngineChoiceType.php +++ b/src/Form/Admin/Type/Wall/Component/ConnectorEngineChoiceType.php @@ -11,15 +11,10 @@ class ConnectorEngineChoiceType extends AbstractType { - protected ConnectorDefinitionRegistry $connectorDefinitionRegistry; - protected ConnectorManagerInterface $connectorManager; - public function __construct( - ConnectorDefinitionRegistry $connectorDefinitionRegistry, - ConnectorManagerInterface $connectorManager + protected ConnectorDefinitionRegistry $connectorDefinitionRegistry, + protected ConnectorManagerInterface $connectorManager ) { - $this->connectorDefinitionRegistry = $connectorDefinitionRegistry; - $this->connectorManager = $connectorManager; } public function configureOptions(OptionsResolver $resolver): void diff --git a/src/SocialDataBundle/Form/Admin/Type/Wall/Component/PimcoreRelationType.php b/src/Form/Admin/Type/Wall/Component/PimcoreRelationType.php similarity index 100% rename from src/SocialDataBundle/Form/Admin/Type/Wall/Component/PimcoreRelationType.php rename to src/Form/Admin/Type/Wall/Component/PimcoreRelationType.php diff --git a/src/SocialDataBundle/Form/Admin/Type/Wall/FeedCollectionType.php b/src/Form/Admin/Type/Wall/FeedCollectionType.php similarity index 100% rename from src/SocialDataBundle/Form/Admin/Type/Wall/FeedCollectionType.php rename to src/Form/Admin/Type/Wall/FeedCollectionType.php diff --git a/src/SocialDataBundle/Form/Admin/Type/Wall/FeedType.php b/src/Form/Admin/Type/Wall/FeedType.php similarity index 91% rename from src/SocialDataBundle/Form/Admin/Type/Wall/FeedType.php rename to src/Form/Admin/Type/Wall/FeedType.php index ee3d7e0..acff698 100644 --- a/src/SocialDataBundle/Form/Admin/Type/Wall/FeedType.php +++ b/src/Form/Admin/Type/Wall/FeedType.php @@ -23,15 +23,10 @@ class FeedType extends AbstractType { use ExtJsTagTransformTrait; - protected ConnectorManagerInterface $connectorManager; - protected EntityManagerInterface $entityManager; - public function __construct( - ConnectorManagerInterface $connectorManager, - EntityManagerInterface $entityManager + protected ConnectorManagerInterface $connectorManager, + protected EntityManagerInterface $entityManager ) { - $this->connectorManager = $connectorManager; - $this->entityManager = $entityManager; } public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/SocialDataBundle/Form/Admin/Type/Wall/WallType.php b/src/Form/Admin/Type/Wall/WallType.php similarity index 92% rename from src/SocialDataBundle/Form/Admin/Type/Wall/WallType.php rename to src/Form/Admin/Type/Wall/WallType.php index be71298..5f70354 100644 --- a/src/SocialDataBundle/Form/Admin/Type/Wall/WallType.php +++ b/src/Form/Admin/Type/Wall/WallType.php @@ -18,11 +18,8 @@ class WallType extends AbstractType { use ExtJsTagTransformTrait; - protected EntityManagerInterface $entityManager; - - public function __construct(EntityManagerInterface $entityManager) + public function __construct(protected EntityManagerInterface $entityManager) { - $this->entityManager = $entityManager; } public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/SocialDataBundle/Form/Traits/ExtJsTagTransformTrait.php b/src/Form/Traits/ExtJsTagTransformTrait.php similarity index 100% rename from src/SocialDataBundle/Form/Traits/ExtJsTagTransformTrait.php rename to src/Form/Traits/ExtJsTagTransformTrait.php diff --git a/src/SocialDataBundle/Logger/Logger.php b/src/Logger/Logger.php similarity index 86% rename from src/SocialDataBundle/Logger/Logger.php rename to src/Logger/Logger.php index 12f049c..773487e 100644 --- a/src/SocialDataBundle/Logger/Logger.php +++ b/src/Logger/Logger.php @@ -4,11 +4,8 @@ class Logger implements LoggerInterface { - protected \Psr\Log\LoggerInterface $logger; - - public function __construct(\Psr\Log\LoggerInterface $logger) + public function __construct(protected \Psr\Log\LoggerInterface $logger) { - $this->logger = $logger; } public function log(string $level, $message, ?array $context = null): void diff --git a/src/SocialDataBundle/Logger/LoggerInterface.php b/src/Logger/LoggerInterface.php similarity index 100% rename from src/SocialDataBundle/Logger/LoggerInterface.php rename to src/Logger/LoggerInterface.php diff --git a/src/SocialDataBundle/Logger/MonologEntryHandler.php b/src/Logger/MonologEntryHandler.php similarity index 89% rename from src/SocialDataBundle/Logger/MonologEntryHandler.php rename to src/Logger/MonologEntryHandler.php index 9b730f4..43f938b 100644 --- a/src/SocialDataBundle/Logger/MonologEntryHandler.php +++ b/src/Logger/MonologEntryHandler.php @@ -3,6 +3,7 @@ namespace SocialDataBundle\Logger; use Monolog\Handler\AbstractProcessingHandler; +use Monolog\LogRecord; use SocialDataBundle\Manager\LogManagerInterface; class MonologEntryHandler extends AbstractProcessingHandler @@ -14,7 +15,7 @@ public function setLogManager(LogManagerInterface $logManager): void $this->logManager = $logManager; } - protected function write(array $record): void + protected function write(LogRecord $record): void { $context = $record['context']; $logEntry = $this->logManager->createNewForConnector($context); diff --git a/src/SocialDataBundle/Logger/ProviderContextConsoleProcessor.php b/src/Logger/ProviderContextConsoleProcessor.php similarity index 92% rename from src/SocialDataBundle/Logger/ProviderContextConsoleProcessor.php rename to src/Logger/ProviderContextConsoleProcessor.php index 482e69b..f4acd90 100644 --- a/src/SocialDataBundle/Logger/ProviderContextConsoleProcessor.php +++ b/src/Logger/ProviderContextConsoleProcessor.php @@ -2,13 +2,14 @@ namespace SocialDataBundle\Logger; +use Monolog\LogRecord; use SocialDataBundle\Model\ConnectorEngineInterface; use SocialDataBundle\Model\FeedInterface; use SocialDataBundle\Model\WallInterface; class ProviderContextConsoleProcessor { - public function __invoke(array $record): array + public function __invoke(LogRecord $record): LogRecord { $extra = []; $context = is_array($record['context']) ? $record['context'] : []; diff --git a/src/SocialDataBundle/Manager/ConnectorManager.php b/src/Manager/ConnectorManager.php similarity index 84% rename from src/SocialDataBundle/Manager/ConnectorManager.php rename to src/Manager/ConnectorManager.php index a37da95..23597aa 100644 --- a/src/SocialDataBundle/Manager/ConnectorManager.php +++ b/src/Manager/ConnectorManager.php @@ -11,21 +11,12 @@ class ConnectorManager implements ConnectorManagerInterface { - protected array $availableConnectors; - protected ConnectorDefinitionRegistryInterface $connectorDefinitionRegistry; - protected ConnectorEngineRepositoryInterface $connectorEngineRepository; - protected EntityManagerInterface $entityManager; - public function __construct( - array $availableConnectors, - ConnectorDefinitionRegistryInterface $connectorDefinitionRegistry, - ConnectorEngineRepositoryInterface $connectorEngineRepository, - EntityManagerInterface $entityManager + protected array $availableConnectors, + protected ConnectorDefinitionRegistryInterface $connectorDefinitionRegistry, + protected ConnectorEngineRepositoryInterface $connectorEngineRepository, + protected EntityManagerInterface $entityManager ) { - $this->availableConnectors = $availableConnectors; - $this->connectorDefinitionRegistry = $connectorDefinitionRegistry; - $this->connectorEngineRepository = $connectorEngineRepository; - $this->entityManager = $entityManager; } public function getAllActiveConnectorDefinitions(): array diff --git a/src/SocialDataBundle/Manager/ConnectorManagerInterface.php b/src/Manager/ConnectorManagerInterface.php similarity index 100% rename from src/SocialDataBundle/Manager/ConnectorManagerInterface.php rename to src/Manager/ConnectorManagerInterface.php diff --git a/src/SocialDataBundle/Manager/FeedPostManager.php b/src/Manager/FeedPostManager.php similarity index 85% rename from src/SocialDataBundle/Manager/FeedPostManager.php rename to src/Manager/FeedPostManager.php index f7d03a6..b8961d3 100644 --- a/src/SocialDataBundle/Manager/FeedPostManager.php +++ b/src/Manager/FeedPostManager.php @@ -3,7 +3,6 @@ namespace SocialDataBundle\Manager; use Doctrine\DBAL\Connection; -use Doctrine\DBAL\Driver\Statement; use Doctrine\DBAL\Query\QueryBuilder; use Pimcore\Model\DataObject\Concrete; use SocialDataBundle\Model\FeedInterface; @@ -11,11 +10,8 @@ class FeedPostManager implements FeedPostManagerInterface { - protected EntityManagerInterface $entityManager; - - public function __construct(EntityManagerInterface $entityManager) + public function __construct(protected EntityManagerInterface $entityManager) { - $this->entityManager = $entityManager; } public function connectFeedWithPost(FeedInterface $feed, Concrete $socialPost): void @@ -48,8 +44,7 @@ protected function relationExists(FeedInterface $feed, Concrete $socialPost): bo 'postId' => $socialPost->getId() ]); - /** @var Statement $stmt */ - $stmt = $qb->execute(); + $stmt = $qb->executeQuery(); return $stmt->rowCount() > 0; } diff --git a/src/SocialDataBundle/Manager/FeedPostManagerInterface.php b/src/Manager/FeedPostManagerInterface.php similarity index 100% rename from src/SocialDataBundle/Manager/FeedPostManagerInterface.php rename to src/Manager/FeedPostManagerInterface.php diff --git a/src/SocialDataBundle/Manager/LogManager.php b/src/Manager/LogManager.php similarity index 82% rename from src/SocialDataBundle/Manager/LogManager.php rename to src/Manager/LogManager.php index c37fa78..38e24a5 100644 --- a/src/SocialDataBundle/Manager/LogManager.php +++ b/src/Manager/LogManager.php @@ -13,18 +13,11 @@ class LogManager implements LogManagerInterface { - protected LogRepositoryInterface $logRepository; - protected ConnectorManagerInterface $connectorManager; - protected EntityManagerInterface $entityManager; - public function __construct( - LogRepositoryInterface $logRepository, - ConnectorManagerInterface $connectorManager, - EntityManagerInterface $entityManager + protected LogRepositoryInterface $logRepository, + protected ConnectorManagerInterface $connectorManager, + protected EntityManagerInterface $entityManager ) { - $this->logRepository = $logRepository; - $this->connectorManager = $connectorManager; - $this->entityManager = $entityManager; } public function getForConnectorEngine(int $connectorEngineId): Paginator diff --git a/src/SocialDataBundle/Manager/LogManagerInterface.php b/src/Manager/LogManagerInterface.php similarity index 100% rename from src/SocialDataBundle/Manager/LogManagerInterface.php rename to src/Manager/LogManagerInterface.php diff --git a/src/SocialDataBundle/Manager/SocialPostManager.php b/src/Manager/SocialPostManager.php similarity index 94% rename from src/SocialDataBundle/Manager/SocialPostManager.php rename to src/Manager/SocialPostManager.php index 10355a5..647260a 100644 --- a/src/SocialDataBundle/Manager/SocialPostManager.php +++ b/src/Manager/SocialPostManager.php @@ -16,21 +16,12 @@ class SocialPostManager implements SocialPostManagerInterface { - protected LoggerInterface $logger; - protected FeedPostManagerInterface $feedPostManager; - protected SocialPostRepositoryInterface $socialPostRepository; - protected SocialPostFactoryInterface $socialPostFactory; - public function __construct( - LoggerInterface $logger, - FeedPostManagerInterface $feedPostManager, - SocialPostRepositoryInterface $socialPostRepository, - SocialPostFactoryInterface $socialPostFactory + protected LoggerInterface $logger, + protected FeedPostManagerInterface $feedPostManager, + protected SocialPostRepositoryInterface $socialPostRepository, + protected SocialPostFactoryInterface $socialPostFactory ) { - $this->logger = $logger; - $this->feedPostManager = $feedPostManager; - $this->socialPostRepository = $socialPostRepository; - $this->socialPostFactory = $socialPostFactory; } public function checkWallStoragePaths(WallInterface $wall): void diff --git a/src/SocialDataBundle/Manager/SocialPostManagerInterface.php b/src/Manager/SocialPostManagerInterface.php similarity index 100% rename from src/SocialDataBundle/Manager/SocialPostManagerInterface.php rename to src/Manager/SocialPostManagerInterface.php diff --git a/src/SocialDataBundle/Manager/WallManager.php b/src/Manager/WallManager.php similarity index 84% rename from src/SocialDataBundle/Manager/WallManager.php rename to src/Manager/WallManager.php index a44e4a2..c51701a 100644 --- a/src/SocialDataBundle/Manager/WallManager.php +++ b/src/Manager/WallManager.php @@ -10,15 +10,10 @@ class WallManager implements WallManagerInterface { - protected WallRepositoryInterface $wallRepository; - protected EntityManagerInterface $entityManager; - public function __construct( - WallRepositoryInterface $wallRepository, - EntityManagerInterface $entityManager + protected WallRepositoryInterface $wallRepository, + protected EntityManagerInterface $entityManager ) { - $this->wallRepository = $wallRepository; - $this->entityManager = $entityManager; } public function getAll(): array diff --git a/src/SocialDataBundle/Manager/WallManagerInterface.php b/src/Manager/WallManagerInterface.php similarity index 100% rename from src/SocialDataBundle/Manager/WallManagerInterface.php rename to src/Manager/WallManagerInterface.php diff --git a/src/SocialDataBundle/Migrations/.gitkeep b/src/Migrations/.gitkeep similarity index 100% rename from src/SocialDataBundle/Migrations/.gitkeep rename to src/Migrations/.gitkeep diff --git a/src/SocialDataBundle/Model/ConnectorEngine.php b/src/Model/ConnectorEngine.php similarity index 100% rename from src/SocialDataBundle/Model/ConnectorEngine.php rename to src/Model/ConnectorEngine.php diff --git a/src/SocialDataBundle/Model/ConnectorEngineInterface.php b/src/Model/ConnectorEngineInterface.php similarity index 100% rename from src/SocialDataBundle/Model/ConnectorEngineInterface.php rename to src/Model/ConnectorEngineInterface.php diff --git a/src/SocialDataBundle/Model/Feed.php b/src/Model/Feed.php similarity index 100% rename from src/SocialDataBundle/Model/Feed.php rename to src/Model/Feed.php diff --git a/src/SocialDataBundle/Model/FeedInterface.php b/src/Model/FeedInterface.php similarity index 100% rename from src/SocialDataBundle/Model/FeedInterface.php rename to src/Model/FeedInterface.php diff --git a/src/SocialDataBundle/Model/LogEntry.php b/src/Model/LogEntry.php similarity index 100% rename from src/SocialDataBundle/Model/LogEntry.php rename to src/Model/LogEntry.php diff --git a/src/SocialDataBundle/Model/LogEntryInterface.php b/src/Model/LogEntryInterface.php similarity index 100% rename from src/SocialDataBundle/Model/LogEntryInterface.php rename to src/Model/LogEntryInterface.php diff --git a/src/SocialDataBundle/Model/SocialPostInterface.php b/src/Model/SocialPostInterface.php similarity index 100% rename from src/SocialDataBundle/Model/SocialPostInterface.php rename to src/Model/SocialPostInterface.php diff --git a/src/SocialDataBundle/Model/Tag.php b/src/Model/Tag.php similarity index 100% rename from src/SocialDataBundle/Model/Tag.php rename to src/Model/Tag.php diff --git a/src/SocialDataBundle/Model/TagInterface.php b/src/Model/TagInterface.php similarity index 100% rename from src/SocialDataBundle/Model/TagInterface.php rename to src/Model/TagInterface.php diff --git a/src/SocialDataBundle/Model/Wall.php b/src/Model/Wall.php similarity index 100% rename from src/SocialDataBundle/Model/Wall.php rename to src/Model/Wall.php diff --git a/src/SocialDataBundle/Model/WallInterface.php b/src/Model/WallInterface.php similarity index 100% rename from src/SocialDataBundle/Model/WallInterface.php rename to src/Model/WallInterface.php diff --git a/src/SocialDataBundle/Processor/SocialPostBuilderProcessor.php b/src/Processor/SocialPostBuilderProcessor.php similarity index 92% rename from src/SocialDataBundle/Processor/SocialPostBuilderProcessor.php rename to src/Processor/SocialPostBuilderProcessor.php index 3d063d5..fd572a1 100644 --- a/src/SocialDataBundle/Processor/SocialPostBuilderProcessor.php +++ b/src/Processor/SocialPostBuilderProcessor.php @@ -28,27 +28,14 @@ class SocialPostBuilderProcessor { - protected LoggerInterface $logger; - protected LockServiceInterface $lockService; - protected EventDispatcherInterface $eventDispatcher; - protected WallManagerInterface $wallManager; - protected SocialPostManagerInterface $socialPostManager; - protected ConnectorManagerInterface $connectorManager; - public function __construct( - LoggerInterface $logger, - LockServiceInterface $lockService, - EventDispatcherInterface $eventDispatcher, - WallManagerInterface $wallManager, - SocialPostManagerInterface $socialPostManager, - ConnectorManagerInterface $connectorManager + protected LoggerInterface $logger, + protected LockServiceInterface $lockService, + protected EventDispatcherInterface $eventDispatcher, + protected WallManagerInterface $wallManager, + protected SocialPostManagerInterface $socialPostManager, + protected ConnectorManagerInterface $connectorManager ) { - $this->logger = $logger; - $this->lockService = $lockService; - $this->eventDispatcher = $eventDispatcher; - $this->wallManager = $wallManager; - $this->socialPostManager = $socialPostManager; - $this->connectorManager = $connectorManager; } public function process(bool $forceProcessing, ?int $wallId): void diff --git a/src/SocialDataBundle/Registry/ConnectorDefinitionRegistry.php b/src/Registry/ConnectorDefinitionRegistry.php similarity index 100% rename from src/SocialDataBundle/Registry/ConnectorDefinitionRegistry.php rename to src/Registry/ConnectorDefinitionRegistry.php diff --git a/src/SocialDataBundle/Registry/ConnectorDefinitionRegistryInterface.php b/src/Registry/ConnectorDefinitionRegistryInterface.php similarity index 100% rename from src/SocialDataBundle/Registry/ConnectorDefinitionRegistryInterface.php rename to src/Registry/ConnectorDefinitionRegistryInterface.php diff --git a/src/SocialDataBundle/Repository/ConnectorEngineRepository.php b/src/Repository/ConnectorEngineRepository.php similarity index 100% rename from src/SocialDataBundle/Repository/ConnectorEngineRepository.php rename to src/Repository/ConnectorEngineRepository.php diff --git a/src/SocialDataBundle/Repository/ConnectorEngineRepositoryInterface.php b/src/Repository/ConnectorEngineRepositoryInterface.php similarity index 100% rename from src/SocialDataBundle/Repository/ConnectorEngineRepositoryInterface.php rename to src/Repository/ConnectorEngineRepositoryInterface.php diff --git a/src/SocialDataBundle/Repository/LogRepository.php b/src/Repository/LogRepository.php similarity index 97% rename from src/SocialDataBundle/Repository/LogRepository.php rename to src/Repository/LogRepository.php index 1456298..c65a9de 100644 --- a/src/SocialDataBundle/Repository/LogRepository.php +++ b/src/Repository/LogRepository.php @@ -3,7 +3,7 @@ namespace SocialDataBundle\Repository; use Carbon\Carbon; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Tools\Pagination\Paginator; @@ -49,7 +49,7 @@ public function deleteExpired(int $expireDays): void $query = $qb->delete() ->where('l.creationDate < :expires') - ->setParameter('expires', $expireDate->toDateTime(), Type::DATETIME) + ->setParameter('expires', $expireDate->toDateTime(), Types::DATETIME_MUTABLE) ->getQuery(); $query->execute(); diff --git a/src/SocialDataBundle/Repository/LogRepositoryInterface.php b/src/Repository/LogRepositoryInterface.php similarity index 100% rename from src/SocialDataBundle/Repository/LogRepositoryInterface.php rename to src/Repository/LogRepositoryInterface.php diff --git a/src/SocialDataBundle/Repository/SocialPostRepository.php b/src/Repository/SocialPostRepository.php similarity index 97% rename from src/SocialDataBundle/Repository/SocialPostRepository.php rename to src/Repository/SocialPostRepository.php index 8393bd7..2de7584 100644 --- a/src/SocialDataBundle/Repository/SocialPostRepository.php +++ b/src/Repository/SocialPostRepository.php @@ -12,11 +12,8 @@ class SocialPostRepository implements SocialPostRepositoryInterface { - protected EnvironmentService $environmentService; - - public function __construct(EnvironmentService $environmentService) + public function __construct(protected EnvironmentService $environmentService) { - $this->environmentService = $environmentService; } public function findOneByIdAndSocialType(string $socialPostId, string $socialPostType, bool $unpublished = false): ?SocialPostInterface @@ -192,7 +189,7 @@ public function getFeedPostJoinListing(bool $unpublished = false, bool $joinWall $listing->onCreateQueryBuilder(function (QueryBuilder $query) use ($joinWallTagTables, $joinFeedTagTables, $aliasFrom) { $query - ->join($aliasFrom, 'social_data_feed_post', 'fp', 'fp.post_id = o_id') + ->join($aliasFrom, 'social_data_feed_post', 'fp', 'fp.post_id = id') ->join($aliasFrom, 'social_data_feed', 'f', 'f.id = fp.feed_id'); if ($joinWallTagTables === true) { diff --git a/src/SocialDataBundle/Repository/SocialPostRepositoryInterface.php b/src/Repository/SocialPostRepositoryInterface.php similarity index 100% rename from src/SocialDataBundle/Repository/SocialPostRepositoryInterface.php rename to src/Repository/SocialPostRepositoryInterface.php diff --git a/src/SocialDataBundle/Repository/WallRepository.php b/src/Repository/WallRepository.php similarity index 100% rename from src/SocialDataBundle/Repository/WallRepository.php rename to src/Repository/WallRepository.php diff --git a/src/SocialDataBundle/Repository/WallRepositoryInterface.php b/src/Repository/WallRepositoryInterface.php similarity index 100% rename from src/SocialDataBundle/Repository/WallRepositoryInterface.php rename to src/Repository/WallRepositoryInterface.php diff --git a/src/SocialDataBundle/Service/ConnectorService.php b/src/Service/ConnectorService.php similarity index 100% rename from src/SocialDataBundle/Service/ConnectorService.php rename to src/Service/ConnectorService.php diff --git a/src/SocialDataBundle/Service/ConnectorServiceInterface.php b/src/Service/ConnectorServiceInterface.php similarity index 100% rename from src/SocialDataBundle/Service/ConnectorServiceInterface.php rename to src/Service/ConnectorServiceInterface.php diff --git a/src/SocialDataBundle/Service/EnvironmentService.php b/src/Service/EnvironmentService.php similarity index 58% rename from src/SocialDataBundle/Service/EnvironmentService.php rename to src/Service/EnvironmentService.php index 693f269..84d10cb 100644 --- a/src/SocialDataBundle/Service/EnvironmentService.php +++ b/src/Service/EnvironmentService.php @@ -4,11 +4,8 @@ class EnvironmentService implements EnvironmentServiceInterface { - protected string $socialPostDataClass; - - public function __construct(string $socialPostDataClass) + public function __construct(protected string $socialPostDataClass) { - $this->socialPostDataClass = $socialPostDataClass; } public function getSocialPostDataClass(): string diff --git a/src/SocialDataBundle/Service/EnvironmentServiceInterface.php b/src/Service/EnvironmentServiceInterface.php similarity index 100% rename from src/SocialDataBundle/Service/EnvironmentServiceInterface.php rename to src/Service/EnvironmentServiceInterface.php diff --git a/src/SocialDataBundle/Service/LockService.php b/src/Service/LockService.php similarity index 100% rename from src/SocialDataBundle/Service/LockService.php rename to src/Service/LockService.php diff --git a/src/SocialDataBundle/Service/LockServiceInterface.php b/src/Service/LockServiceInterface.php similarity index 100% rename from src/SocialDataBundle/Service/LockServiceInterface.php rename to src/Service/LockServiceInterface.php diff --git a/src/SocialDataBundle/Service/StatisticService.php b/src/Service/StatisticService.php similarity index 82% rename from src/SocialDataBundle/Service/StatisticService.php rename to src/Service/StatisticService.php index bd71446..e59ce40 100644 --- a/src/SocialDataBundle/Service/StatisticService.php +++ b/src/Service/StatisticService.php @@ -8,11 +8,8 @@ class StatisticService implements StatisticServiceInterface { - protected SocialPostRepositoryInterface $socialPostRepository; - - public function __construct(SocialPostRepositoryInterface $socialPostRepository) + public function __construct(protected SocialPostRepositoryInterface $socialPostRepository) { - $this->socialPostRepository = $socialPostRepository; } public function getWallStatistics(WallInterface $wall): array diff --git a/src/SocialDataBundle/Service/StatisticServiceInterface.php b/src/Service/StatisticServiceInterface.php similarity index 100% rename from src/SocialDataBundle/Service/StatisticServiceInterface.php rename to src/Service/StatisticServiceInterface.php diff --git a/src/SocialDataBundle/SocialDataBundle.php b/src/SocialDataBundle.php similarity index 63% rename from src/SocialDataBundle/SocialDataBundle.php rename to src/SocialDataBundle.php index 9ba4018..da865f7 100644 --- a/src/SocialDataBundle/SocialDataBundle.php +++ b/src/SocialDataBundle.php @@ -20,13 +20,18 @@ public function getInstaller(): Install return $this->container->get(Install::class); } - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { $this->configureDoctrineExtension($container); $container->addCompilerPass(new ConnectorDefinitionPass()); } + public function getPath(): string + { + return \dirname(__DIR__); + } + protected function getComposerPackageName(): string { return self::PACKAGE_NAME; @@ -43,29 +48,6 @@ protected function configureDoctrineExtension(ContainerBuilder $container): void ); } - public function getCssPaths(): array - { - return [ - '/bundles/socialdata/css/admin.css' - ]; - } - - public function getJsPaths(): array - { - return [ - '/bundles/socialdata/js/component/relation.js', - '/bundles/socialdata/js/component/relationTextField.js', - '/bundles/socialdata/js/component/connectWindow.js', - '/bundles/socialdata/js/plugin.js', - '/bundles/socialdata/js/settingsPanel.js', - '/bundles/socialdata/js/wallsPanel.js', - '/bundles/socialdata/js/wall/mainPanel.js', - '/bundles/socialdata/js/connector/abstract-connector.js', - '/bundles/socialdata/js/feed/abstract-feed.js', - '/bundles/socialdata/js/vendor/dataObject.js', - ]; - } - protected function getNamespaceName(): string { return 'SocialDataBundle\Model'; @@ -74,7 +56,7 @@ protected function getNamespaceName(): string protected function getNameSpacePath(): string { return sprintf( - '%s/Resources/config/doctrine/%s', + '%s/config/doctrine/%s', $this->getPath(), 'model' ); diff --git a/src/SocialDataBundle/Resources/config/services.yml b/src/SocialDataBundle/Resources/config/services.yml deleted file mode 100644 index 50ca291..0000000 --- a/src/SocialDataBundle/Resources/config/services.yml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: services/*.yml } \ No newline at end of file diff --git a/src/SocialDataBundle/SocialDataEvents.php b/src/SocialDataEvents.php similarity index 100% rename from src/SocialDataBundle/SocialDataEvents.php rename to src/SocialDataEvents.php diff --git a/src/SocialDataBundle/Tool/Install.php b/src/Tool/Install.php similarity index 87% rename from src/SocialDataBundle/Tool/Install.php rename to src/Tool/Install.php index b5ceac5..ac04703 100644 --- a/src/SocialDataBundle/Tool/Install.php +++ b/src/Tool/Install.php @@ -2,8 +2,7 @@ namespace SocialDataBundle\Tool; -use Pimcore\Bundle\AdminBundle\Security\User\TokenStorageUserResolver; -use Pimcore\Db\Connection; +use Pimcore\Security\User\TokenStorageUserResolver; use Pimcore\Extension\Bundle\Installer\Exception\InstallationException; use Pimcore\Extension\Bundle\Installer\SettingsStoreAwareInstaller; use Pimcore\Model\User\Permission; @@ -39,9 +38,8 @@ public function install(): void protected function installDbStructure(): void { - /** @var Connection $db */ $db = \Pimcore\Db::get(); - $db->query(file_get_contents($this->getInstallSourcesPath() . '/sql/install.sql')); + $db->executeQuery(file_get_contents($this->getInstallSourcesPath() . '/sql/install.sql')); } protected function installPermissions(): void @@ -68,6 +66,6 @@ protected function installPermissions(): void protected function getInstallSourcesPath(): string { - return __DIR__ . '/../Resources/install'; + return __DIR__ . '/../../config/install'; } } diff --git a/src/SocialDataBundle/Resources/views/connect-response.html.twig b/templates/connect-response.html.twig similarity index 100% rename from src/SocialDataBundle/Resources/views/connect-response.html.twig rename to templates/connect-response.html.twig diff --git a/tests/Functional.suite.dist.yml b/tests/Functional.suite.dist.yml new file mode 100644 index 0000000..3b28e68 --- /dev/null +++ b/tests/Functional.suite.dist.yml @@ -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 diff --git a/tests/functional/_bootstrap.php b/tests/Functional/_bootstrap.php similarity index 100% rename from tests/functional/_bootstrap.php rename to tests/Functional/_bootstrap.php diff --git a/tests/Support/FunctionalTester.php b/tests/Support/FunctionalTester.php new file mode 100644 index 0000000..80598b8 --- /dev/null +++ b/tests/Support/FunctionalTester.php @@ -0,0 +1,8 @@ + - Test Page for Test Bundle + {{ pimcore_head_title() }} {{ pimcore_head_meta() }} {{ pimcore_head_link() }} @@ -10,7 +10,7 @@
{% if document is defined %} - {{ document.getId() }} + {{ document.id }} {% endif %}
{% block content %} diff --git a/tests/_etc/config/bundle/config_default.yml b/tests/_etc/config/bundle/config_default.yaml similarity index 100% rename from tests/_etc/config/bundle/config_default.yml rename to tests/_etc/config/bundle/config_default.yaml diff --git a/tests/_support/FunctionalTester.php b/tests/_support/FunctionalTester.php deleted file mode 100644 index 6d89997..0000000 --- a/tests/_support/FunctionalTester.php +++ /dev/null @@ -1,8 +0,0 @@ -