Skip to content

Commit

Permalink
fix(revisions): fix remaining revisionService renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelAlphonso committed Nov 8, 2022
1 parent d8576c0 commit 2336a50
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ class RevertRevisionAction extends AdminAction implements ObjectContainerInterfa
*/
protected $revNum;

private RevisionsManager $revisionService;
private RevisionsManager $revisionManager;

protected function setDependencies(Container $container)
{
parent::setDependencies($container);

$this->revisionService = $container->get('revisions/manager');
$this->revisionManager = $container->get('revisions/manager');
}

/**
Expand Down Expand Up @@ -119,9 +119,9 @@ public function run(RequestInterface $request, ResponseInterface $response)

$obj = $this->obj();
$revNum = $this->revNum();
$this->revisionService->setModel($obj);
$this->revisionManager->setModel($obj);

$revision = $this->revisionService->getRevisionFromNumber($revNum);
$revision = $this->revisionManager->getRevisionFromNumber($revNum);
if (!$revision['id']) {
$this->setSuccess(false);

Expand All @@ -141,7 +141,7 @@ public function run(RequestInterface $request, ResponseInterface $response)
return $response->withStatus(404);
}

$result = $this->revisionService->revertToRevision($revNum);
$result = $this->revisionManager->revertToRevision($revNum);

if ($result) {
$doneMessage = $translator->translate(
Expand Down
8 changes: 4 additions & 4 deletions packages/admin/src/Charcoal/Admin/Ui/ObjectRevisionsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public function objectRevisions(): array
$obj = $this->modelFactory()->create($this->objType());
$obj->setId($this->objId());

$this->revisionService()->setModel($obj);
$this->revisionManager()->setModel($obj);

$lastRevision = $this->revisionService()->getLatestRevision();
$lastRevision = $this->revisionManager()->getLatestRevision();
$propLabel = '<span title="%1$s">%2$s</code>';

$callback = function (ObjectRevisionInterface &$revision) use ($lastRevision, $obj, $propLabel) {
Expand Down Expand Up @@ -70,7 +70,7 @@ public function objectRevisions(): array
$revision->allowRevert = ($lastRevision['revNum'] !== $revision['revNum']);
};

return $this->revisionService()->getAllRevisions($callback);
return $this->revisionManager()->getAllRevisions($callback);
}

/**
Expand All @@ -92,5 +92,5 @@ abstract public function objId();
*/
abstract protected function modelFactory();

abstract protected function revisionService(): RevisionsManager;
abstract protected function revisionManager(): RevisionsManager;
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ class ObjectRevisionsFormGroup extends AbstractFormGroup implements
*/
public $widgetId;

private RevisionsManager $revisionService;
private RevisionsManager $revisionManager;

protected function revisionService(): RevisionsManager
protected function revisionManager(): RevisionsManager
{
return $this->revisionService;
return $this->revisionManager;
}

/**
Expand Down Expand Up @@ -117,7 +117,7 @@ protected function setDependencies(Container $container)
parent::setDependencies($container);

$this->setModelFactory($container['model/factory']);
$this->revisionService = $container['revisions/manager'];
$this->revisionManager = $container['revisions/manager'];

$this->objType = $container['request']->getParam('obj_type');
$this->objId = $container['request']->getParam('obj_id');
Expand Down
10 changes: 5 additions & 5 deletions packages/admin/src/Charcoal/Admin/Widget/FormSidebarWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class FormSidebarWidget extends AdminWidget implements
*/
private $requiredGlobalAclPermissions = [];

private RevisionsManager $revisionService;
private RevisionsManager $revisionManager;

/**
* @param array|ArrayInterface $data Class data.
Expand Down Expand Up @@ -554,10 +554,10 @@ public function isObjRevisionable()
return $this->isObjRevisionable;
}

$this->revisionService->setModel($obj);
$this->revisionManager->setModel($obj);

if ($this->revisionService->isRevisionEnabled()) {
$this->isObjRevisionable = !!count($this->revisionService->getAllRevisions());
if ($this->revisionManager->isRevisionEnabled()) {
$this->isObjRevisionable = !!count($this->revisionManager->getAllRevisions());
}
}
}
Expand Down Expand Up @@ -903,6 +903,6 @@ protected function setDependencies(Container $container)
{
parent::setDependencies($container);

$this->revisionService = $container['revisions/manager'];
$this->revisionManager = $container['revisions/manager'];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ class ObjectRevisionsWidget extends AdminWidget implements
*/
protected $objId;

private RevisionsManager $revisionService;
private RevisionsManager $revisionManager;

protected function setDependencies(Container $container)
{
parent::setDependencies($container);

$this->revisionService = $container['revisions/manager'];
$this->revisionManager = $container['revisions/manager'];
}

protected function revisionService(): RevisionsManager
protected function revisionManager(): RevisionsManager
{
return $this->revisionService;
return $this->revisionManager;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
*/
class GenerateRevisionListener extends AbstractEventListener
{
protected RevisionsManager $revisionService;
protected RevisionsManager $revisionManager;

public function __invoke(object $event)
{
/** @var ModelInterface $model */
$model = $event->getObject();

$this->revisionService->setModel($model)->generateRevision();
$this->revisionManager->setModel($model)->generateRevision();
}

public function setDependencies(Container $container)
{
parent::setDependencies($container);

$this->revisionService = $container->get('revisions/manager');
$this->revisionManager = $container->get('revisions/manager');
}
}

0 comments on commit 2336a50

Please sign in to comment.