Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Config/services.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

use Mautic\CoreBundle\DependencyInjection\MauticCoreExtension;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $configurator) {
$services = $configurator->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');
};
19 changes: 19 additions & 0 deletions DependencyInjection/HelloWorldExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace MauticPlugin\HelloWorldBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;

class HelloWorldExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Config'));
$loader->load('services.php');
}
}
6 changes: 3 additions & 3 deletions Entity/World.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions Form/Type/ConfigAuthType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]
Expand Down
2 changes: 1 addition & 1 deletion Integration/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}'.");
}

/**
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
25 changes: 21 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"php": ">=8.0.0",
"php": ">=8.1.0",

See: https://mautic.org/mautic-requirements/
M6 supports PHP 8.1, 8.2 and 8.3.

"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 ."
}
}
Loading