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

[Symfony 6] Problems with the "minishlink_web_push" service #25

Open
vadegangas opened this issue Mar 17, 2023 · 4 comments
Open

[Symfony 6] Problems with the "minishlink_web_push" service #25

vadegangas opened this issue Mar 17, 2023 · 4 comments

Comments

@vadegangas
Copy link

Good morning

install the Minishlink/web-push-bundle v6.0.3 package on a symfony 6.

When trying to recover the service as the documentation says:

$webPush = $this->container->get('minishlink_web_push');

symfony complains that the indicated service is not found in the container.

So try dependency injection:

use Doctrine\Persistence\ManagerRegistry;
use Minishlink\WebPush\WebPush;

class functionsNotifications
{
public function __construct(private WebPush $webPush, private ManagerRegistry $doctrine)
{}

public function notify()
{
    dd($this->webPush);
}

}

but symfony throws the error

Cannot autowire service "App\Utils\NotificationFunctions": argument "$webPush" of method "__construct()" references class "Minishlink\WebPush\WebPush" but no such service exists. You should maybe alias this class to the existing "minishlink_web_push" service.

I would appreciate any help.

@Minishlink
Copy link
Owner

Hello, this bundle might not be compatible with the latest symfony versions, I haven't updated it in a while. There might have been a change in Symfony in how bundles are loaded, feel free to send a PR :) Otherwise you can use this other bundle that uses web-push, the same library that this bundle uses https://github.com/bpolaszek/webpush-bundle

@vadegangas
Copy link
Author

Good again.

Thank you for your quick answer.

The bundle that you recommend requires pairing the endpoints with users and in my case that is not possible.

I'll look to see if I can find another.

It's a shame it doesn't last.

all the best.

@franciscosantamaria
Copy link
Contributor

Hi @vadegangas , I know I'm late to this conversation, but you can still make this alias in your application and still using this bundle with Symfony 6:

Inside services.yaml:

services:

    //...

    Minishlink\WebPush\WebPush: '@minishlink_web_push'

Anyway, I can make a PR adding this alias in this bundle to avoid manually add it in every app that uses this bundle.

It's ok for you @Minishlink @stephanvierkant ?

@Minishlink
Copy link
Owner

Hello @franciscosantamaria, yes please if you can make it easer for others please do 🙏🏻

@Minishlink Minishlink changed the title Problems with the "minishlink_web_push" service [Symfony 6] Problems with the "minishlink_web_push" service May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants