forked from mautic/mautic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Trying to autowire all services * Moving BatchIdToEntityHelper to DTO namespace which is excuded from autowiring * Autowire all services in app/bundles except some classes that are not services like exception and DTO objects * Commands are autowired automatically. Existing services must set at least an alias for BC * Moving BatchIdToEntityHelper back and rather excluding it in services.php as it would require more refactoring * Allow bundles to configure their own services and use default configuration if not to keep BC * Removing an empty file * Fixing types * Controllers must be excluded by default until we refactor them to use DI * Moving campaign-related DI excludes from global config to CampaignBundle * Moving email-related DI excludes from global config to EmailBundle * Moving report-related DI excludes from global config to ReportBundle * Moving form-related DI excludes from global config to FormBundle * Moving channel-related DI excludes from global config to ChannelBundle * Moving a DTO class from Model to DTO dir to avoid autowiring error * Moving api-related DI excludes from global config to ApiBundle * Moving install-related DI excludes from global config to InstallBundle * Moving integrations-related DI excludes from global config to IntegrationslBundle * Moving plugin-related DI excludes from global config to PluginBundle * Moving queue-related DI excludes from global config to QueueBundle * Moving stats-related DI excludes from global config to StatsBundle * Configuring plugins to be autowireable * Fixing types * Updating class comments * Fixing CRM bundle DI config * Get the autowired service if it exists rather than always creating it * Removing duplicated service definition and moving repository services in one place to avoid further duplicates * Moving legacy service configuration from the MauticCoreExtension to ServicePass * Configuring Doctrine repositories as services visible by autowiring * Removing all command services from config.php files and relying on autowiring and autoconfiguration * Removing subscriber service definitions part 1 * Rewriting useless unit test of a repostitory method to a functional test * checkGenericClassInNonGenericObjectType rule is causing big troubles with antipaterns like getting a repository out of EM. * Type fixes * Fixing repository tests after they started extending ServiceEntityRepository * Removing subscriber service definitions part 2 * Fixing report repositories * Fixing FrequencyRuleRepository service * Another round of repository test fixes * Using FQCN instead of mautic.http.client.mock_handler in tests * Moving overwriting of the HTTP client for tests from config to a compiler pass because I moved the legacy service configuration from MauticCoreExtension to ServicePass and so it was called after the config_test.php service and did not overwrite the service as it was created afterwards. * Moving overwriding of the PipeDrive HTTP client from config_test to its own compiler pass to be executed at the right time and also for separation of concerns * Fixing logger methods after the namespace was updated * The font URLs have now escaped slashes * Enabling autowiring for controllers * Leaving autowiring of controllers for another PR * Removing form type service definitions part 1 the aliases were refactored for Symfony 4 support * Removing form type service definitions part 2 * Autoconfiguring Mautic Models * Converting some services from legacy DI to autowiring keeping aliases for BC * Documenting the changes in the upgrading doc * Removing option to set service aliases in config.php. They should be defined in services.php instead * Resolving "42x: Referencing controllers with MauticLeadBundle:Lead:contactStats is deprecated since Symfony 4.1, use "Mautic\LeadBundle\Controller\LeadController::contactStatsAction" instead." * Fixing unsubscribing from a channel * Loading citrix repositories * Removing twig extension definitions as those are now autowired and autoconfigured. They are not used as services * Configuring the AssetsHelper to be set properly * Fixing autowirng for new exception after rebase * Excluding new DTOs recently added to 5.x
- Loading branch information
Showing
148 changed files
with
1,901 additions
and
4,418 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Mautic\CoreBundle\DependencyInjection\MauticCoreExtension; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
|
||
return function (ContainerConfigurator $configurator) { | ||
$services = $configurator->services() | ||
->defaults() | ||
->autowire() | ||
->autoconfigure() | ||
->public(); | ||
|
||
$excludes = [ | ||
'Serializer/Driver', | ||
'Serializer/Exclusion', | ||
'Helper/BatchIdToEntityHelper.php', | ||
]; | ||
|
||
$services->load('Mautic\\ApiBundle\\', '../') | ||
->exclude('../{'.implode(',', array_merge(MauticCoreExtension::DEFAULT_EXCLUDES, $excludes)).'}'); | ||
|
||
$services->load('Mautic\\ApiBundle\\Entity\\oAuth2\\', '../Entity/oAuth2/*Repository.php'); | ||
}; |
22 changes: 22 additions & 0 deletions
22
app/bundles/ApiBundle/DependencyInjection/MauticApiExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mautic\ApiBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Extension\Extension; | ||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; | ||
|
||
class MauticApiExtension extends Extension | ||
{ | ||
/** | ||
* @param mixed[] $configs | ||
*/ | ||
public function load(array $configs, ContainerBuilder $container): void | ||
{ | ||
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Config')); | ||
$loader->load('services.php'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Mautic\CoreBundle\DependencyInjection\MauticCoreExtension; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
|
||
return function (ContainerConfigurator $configurator) { | ||
$services = $configurator->services() | ||
->defaults() | ||
->autowire() | ||
->autoconfigure() | ||
->public(); | ||
|
||
$excludes = [ | ||
'Controller/UploadController.php', | ||
]; | ||
|
||
$services->load('Mautic\\AssetBundle\\', '../') | ||
->exclude('../{'.implode(',', array_merge(MauticCoreExtension::DEFAULT_EXCLUDES, $excludes)).'}'); | ||
|
||
$services->load('Mautic\\AssetBundle\\Entity\\', '../Entity/*Repository.php'); | ||
$services->alias('mautic.asset.helper.token', \Mautic\AssetBundle\Helper\TokenHelper::class); | ||
$services->alias('mautic.asset.model.asset', \Mautic\AssetBundle\Model\AssetModel::class); | ||
}; |
22 changes: 22 additions & 0 deletions
22
app/bundles/AssetBundle/DependencyInjection/MauticAssetExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mautic\AssetBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Extension\Extension; | ||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; | ||
|
||
class MauticAssetExtension extends Extension | ||
{ | ||
/** | ||
* @param mixed[] $configs | ||
*/ | ||
public function load(array $configs, ContainerBuilder $container): void | ||
{ | ||
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Config')); | ||
$loader->load('services.php'); | ||
} | ||
} |
Oops, something went wrong.