Skip to content

Commit

Permalink
feat(object): add an ObjectServiceProvider for object package services
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelAlphonso committed Nov 8, 2022
1 parent 3051c6b commit a122ba4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"charcoal/config": "^4.1",
"charcoal/event": "^3.2",
"charcoal/factory": "^4.1",
"charcoal/object": "^4.1",
"charcoal/translator": "^4.1",
"charcoal/view": "^4.1",
"monolog/monolog": "^1.17",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use Charcoal\App\Template\TemplateInterface;
use Charcoal\App\Template\WidgetInterface;
use Charcoal\App\Template\WidgetBuilder;
use Charcoal\Object\ObjectServiceProvider;
use Charcoal\View\Twig\DebugHelpers as TwigDebugHelpers;
use Charcoal\View\Twig\HelpersInterface as TwigHelpersInterface;
use Charcoal\View\Twig\UrlHelpers as TwigUrlHelpers;
Expand Down Expand Up @@ -78,6 +79,7 @@ public function register(Container $container)
$container->register(new ScriptServiceProvider());
$container->register(new TranslatorServiceProvider());
$container->register(new ViewServiceProvider());
$container->register(new ObjectServiceProvider());

$this->registerKernelServices($container);
$this->registerHandlerServices($container);
Expand Down
27 changes: 27 additions & 0 deletions packages/object/src/Charcoal/Object/ObjectServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Charcoal\Object;

use Pimple\Container;
use Pimple\ServiceProviderInterface;

/**
* Object Service Provider
*/
class ObjectServiceProvider implements ServiceProviderInterface
{
public function register(Container $pimple)
{
$this->registerRevisionServices($pimple);
}

private function registerRevisionServices(Container $pimple)
{
$pimple['revision/service'] = function (Container $pimple): RevisionService {
return new RevisionService([
'config' => $pimple['admin/config'],
'model/factory' => $pimple['model/factory'],
]);
};
}
}

0 comments on commit a122ba4

Please sign in to comment.