Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Global Service #38

Open
cwa-cc opened this issue Dec 15, 2023 · 1 comment
Open

[Feature] Global Service #38

cwa-cc opened this issue Dec 15, 2023 · 1 comment
Labels
question Further information is requested

Comments

@cwa-cc
Copy link

cwa-cc commented Dec 15, 2023

It's possible to know how to configure a global service to determine if the maintenance mode is enabled or not.

Because I don't found the way to do it.

Thanks in advance

@oallain oallain added the question Further information is requested label Dec 18, 2023
@oallain
Copy link
Member

oallain commented Dec 18, 2023

Hello @cwa-cc ,

You can do somthing like that :

<?php

declare(strict_types=1);

namespace MyNamespace;

use Synolia\SyliusMaintenancePlugin\Factory\MaintenanceConfigurationFactory;

final class MyClass 
{
    public function __construct(
        private MaintenanceConfigurationFactory $configurationFactory,
    ) {
    }
    
    private function isMaintenance(): bool
    {
        return $this->configurationFactory->get()->isEnabled();
    }
}

I hope it help you,
Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants