Skip to content

Commit

Permalink
Moved services from core to plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Feb 1, 2026
1 parent e43954a commit ef8afe5
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 34 deletions.
4 changes: 2 additions & 2 deletions app/plugins/Transmogrify/src/Command/TransmogrifyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
use App\Lib\Util\DBALConnection;
use App\Lib\Util\StringUtilities;
use App\Model\Table\MetaTable;
use App\Service\ConfigLoaderService;
use App\Service\DbInfoService;
use Cake\Console\Arguments;
use Cake\Console\BaseCommand;
use Cake\Console\ConsoleIo;
Expand All @@ -56,6 +54,8 @@
use Transmogrify\Lib\Util\GroupsHealth;
use Transmogrify\Lib\Util\OrgIdentitiesHealth;
use Transmogrify\Lib\Util\RawSqlQueries;
use Transmogrify\Service\ConfigLoaderService;
use Transmogrify\Service\DbInfoService;

class TransmogrifyCommand extends BaseCommand {
use CacheTrait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
namespace Transmogrify\Command;

use App\Lib\Util\DBALConnection;
use App\Service\ConfigLoaderService;
use Cake\Console\Arguments;
use Cake\Console\Command;
use Cake\Console\BaseCommand;
use Cake\Console\ConsoleIo;
use Cake\Console\ConsoleOptionParser;
use Cake\Console\BaseCommand;
use Transmogrify\Service\ConfigLoaderService;

final class TransmogrifySourceToTargetCommand extends BaseCommand
{
Expand Down
3 changes: 1 addition & 2 deletions app/plugins/Transmogrify/src/Lib/Util/DbInfoPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@

namespace Transmogrify\Lib\Util;

use App\Service\DbInfoService;
use Cake\Console\ConsoleIo;
use Transmogrify\Lib\Enum\TransmogrifyEnum;
use Transmogrify\Service\DbInfoService;

/**
* Prints information about database connections and schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

declare(strict_types = 1);

namespace App\Service;
namespace Transmogrify\Service;

final class ConfigLoaderService
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
declare(strict_types=1);

namespace App\Service;
namespace Transmogrify\Service;

use App\Lib\Util\DBALConnection;
use Cake\Datasource\ConnectionManager;
use function App\Service\sort;

/**
* Service to provide reusable DB info logic for console and elsewhere.
Expand Down
14 changes: 8 additions & 6 deletions app/plugins/Transmogrify/src/TransmogrifyPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

namespace Transmogrify;

use Transmogrify\Command\TransmogrifyCommand;
use Transmogrify\Command\TransmogrifySourceToTargetCommand;
use App\Service\ConfigLoaderService;
use App\Service\DbInfoService;
use Cake\Console\CommandCollection;
use Cake\Core\BasePlugin;
use Cake\Core\ContainerInterface;
use Cake\Core\PluginApplicationInterface;
use Cake\Http\MiddlewareQueue;
use Cake\Routing\RouteBuilder;
use Transmogrify\Command\TransmogrifyCommand;
use Transmogrify\Command\TransmogrifySourceToTargetCommand;
use Transmogrify\Service\ConfigLoaderService;
use Transmogrify\Service\DbInfoService;

/**
* Plugin for Transmogrify
Expand Down Expand Up @@ -94,8 +94,10 @@ public function console(CommandCollection $commands): CommandCollection
*/
public function services(ContainerInterface $container): void
{
// Add your services here
// remove this method hook if you don't need it
// Register services so the container can resolve them (constructor autowiring)
$container->add(DbInfoService::class);
$container->add(ConfigLoaderService::class);

$container->add(TransmogrifyCommand::class)
->addArguments([DbInfoService::class, ConfigLoaderService::class]);
$container->add(TransmogrifySourceToTargetCommand::class)
Expand Down
19 changes: 0 additions & 19 deletions app/src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
*/
namespace App;

use App\Service\ConfigLoaderService;
use App\Service\DbInfoService;
use Cake\Core\Configure;
use Cake\Core\ContainerInterface;
use Cake\Core\Exception\MissingPluginException;
use Cake\Error\Middleware\ErrorHandlerMiddleware;
use Cake\Http\BaseApplication;
Expand Down Expand Up @@ -127,20 +124,4 @@ protected function bootstrapCli(): void

// Load more plugins here
}


/**
* Register application container services.
*
* @param \Cake\Core\ContainerInterface $container The Container to update
* @return void
*/
public function services(ContainerInterface $container): void
{
parent::services($container);

// Register services so the container can resolve them (constructor autowiring)
$container->add(DbInfoService::class);
$container->add(ConfigLoaderService::class);
}
}

0 comments on commit ef8afe5

Please sign in to comment.