diff --git a/Config/services.php b/Config/services.php new file mode 100644 index 0000000..3683935 --- /dev/null +++ b/Config/services.php @@ -0,0 +1,23 @@ +services() + ->defaults() + ->autowire() + ->autoconfigure() + ->public(); + + $excludes = [ + 'Connection/Credentials.php', + ]; + + $services->load('MauticPlugin\\HelloWorldBundle\\', '../') + ->exclude('../{'.implode(',', array_merge(MauticCoreExtension::DEFAULT_EXCLUDES, $excludes)).'}'); + + $services->load('MauticPlugin\\HelloWorldBundle\\Entity\\', '../Entity/*Repository.php'); +}; diff --git a/DependencyInjection/HelloWorldExtension.php b/DependencyInjection/HelloWorldExtension.php new file mode 100644 index 0000000..84d04c1 --- /dev/null +++ b/DependencyInjection/HelloWorldExtension.php @@ -0,0 +1,19 @@ +load('services.php'); + } +} diff --git a/Entity/World.php b/Entity/World.php index 5ae0d97..573733a 100644 --- a/Entity/World.php +++ b/Entity/World.php @@ -4,7 +4,7 @@ namespace MauticPlugin\HelloWorldBundle\Entity; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\ClassMetadata; use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder; @@ -29,11 +29,11 @@ public static function loadMetadata(ClassMetadata $metadata): void $builder->addId(); $builder - ->createField('world', Type::STRING) + ->createField('world', Types::STRING) ->build(); $builder - ->createField('isEnabled', Type::BOOLEAN) + ->createField('isEnabled', Types::BOOLEAN) ->columnName('is_enabled') ->build(); } diff --git a/Form/Type/ConfigAuthType.php b/Form/Type/ConfigAuthType.php index ffe7c48..d8dfb33 100644 --- a/Form/Type/ConfigAuthType.php +++ b/Form/Type/ConfigAuthType.php @@ -53,9 +53,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ); } - public function configureOptions(OptionsResolver $optionsResolver): void + public function configureOptions(OptionsResolver $resolver): void { - $optionsResolver->setDefaults( + $resolver->setDefaults( [ 'integration' => null, ] diff --git a/Integration/Config.php b/Integration/Config.php index eeb4bf5..136b7f6 100644 --- a/Integration/Config.php +++ b/Integration/Config.php @@ -90,7 +90,7 @@ public function getFieldDirection(string $objectName, string $alias): string return $this->getMappedFieldsDirections($objectName)[$alias]; } - throw new InvalidValueException("There is no field direction for '{$objectName}' field '${alias}'."); + throw new InvalidValueException("There is no field direction for '{$objectName}' field '{$alias}'."); } /** diff --git a/README.md b/README.md index f5dd686..cc07335 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ # Hello World -This is a sample plugin built for Mautic 4 using the integrations framework included in core that was originally based on the [Integrations plugin](https://github.com/mautic-inc/plugin-integrations). +This is a sample plugin built for Mautic 6 using the integrations framework. -An example for Mautic 2 for the Oauth2 client credentials grant can be found [here](https://github.com/mautic-inc/plugin-helloworld/tree/mautic-2). -An example for Mautic 3 for the Oauth2 authorization code grant can be found [here](https://github.com/mautic-inc/plugin-helloworld/tree/mautic-3-authorization-code-grant-example). - -This can be used as an example in combination with the [Integrations plugin wiki](https://github.com/mautic-inc/plugin-integrations/wiki). +An example for Mautic 2 for the Oauth2 client credentials grant can be found [here](https://github.com/mautic/plugin-helloworld/tree/mautic-2). +An example for Mautic 3 for the Oauth2 authorization code grant can be found [here](https://github.com/mautic/plugin-helloworld/tree/mautic-3-authorization-code-grant-example). This plugin has examples for: diff --git a/composer.json b/composer.json index 2adceeb..93e4a01 100644 --- a/composer.json +++ b/composer.json @@ -1,15 +1,32 @@ { "name": "mautic/helloworld-bundle", - "description": "Hello World plugin built on the Integrations framework.", + "description": "Hello World plugin built on the Integrations.", "type": "mautic-plugin", - "version": "1.0.1", + "version": "2.0.0", "license": "GPL-3.0-or-later", "keywords": ["mautic","plugin","integration"], + "minimum-stability": "dev", "require": { - "php": ">=7.4.0 <8.1", - "mautic/core-lib": "^4.0" + "php": ">=8.0.0", + "mautic/core-lib": "^6.0" }, "extra": { "install-directory-name": "HelloWorldBundle" + }, + "scripts": { + "test": [ + "@phpunit", + "@csfixer" + ], + "quicktest": [ + "@unit", + "@csfixer" + ], + "phpunit": "../../bin/phpunit -d memory_limit=1G --bootstrap ../../vendor/autoload.php --configuration phpunit.xml --fail-on-warning --testsuite=all", + "unit": "../../bin/phpunit -d memory_limit=1G --bootstrap ../../vendor/autoload.php --configuration phpunit.xml --fail-on-warning --testsuite=unit", + "coverage": "../../bin/phpunit -d memory_limit=1G --bootstrap ../../vendor/autoload.php --configuration phpunit.xml --fail-on-warning --testsuite=all --coverage-text --coverage-html=Tests/Coverage", + "csfixer": "../../bin/php-cs-fixer fix . -v --dry-run --diff --using-cache=no --config=../../.php-cs-fixer.php", + "fixcs": "../../bin/php-cs-fixer fix . -v --using-cache=no --config=../../.php-cs-fixer.php", + "phpstan": "[ ! -f ../../var/cache/test/AppKernelTestDebugContainer.xml ] && (echo 'Building test cache ...'; APP_ENV=test APP_DEBUG=1 ../../bin/console > /dev/null 2>&1); php -d memory_limit=4G ../../bin/phpstan analyse ." } }