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

Symfony4, my_receiver is not supported error #86

Open
anthipapa opened this issue Nov 11, 2019 · 6 comments
Open

Symfony4, my_receiver is not supported error #86

anthipapa opened this issue Nov 11, 2019 · 6 comments

Comments

@anthipapa
Copy link

anthipapa commented Nov 11, 2019

I tried using bernard-bundle in my Symfony 4.3 project to run a basic helloWorld background task, but when I try to run bernard: consume I get an error

In SimpleRouter.php line 38:
Given "my_receiver" is not supported. 

This is the services.yaml part

 my_receiver:
        class: App\BackgroundTasks\Receiver\
        tags:
            - { name: bernard.receiver, message: 'HelloWorld' }

It says the error is in SimpleRouter, so I tried debugging there using

var_dump($name);
var_dump($receiver);
var_dump(class_exists($receiver)); 

and I got

string(10) "HelloWorld"
string(11) "my_receiver"
bool(false)

Is this a bug because of Symfony? Or am I missing something?

@acrobat
Copy link
Member

acrobat commented Nov 11, 2019

I think the class you provided for the my_receiver service is incorrect. In you example above it is class: App\BackgroundTasks\Receiver\, but it looks like to forgot the actual class as the end of the namespace of a \ too much at the end.

@anthipapa
Copy link
Author

I have already tried
App\BackgroundTasks\Receiver
and
App\BackgroundTasks\Receiver\Receiver
and both result in the same error I mentioned before.

@acrobat
Copy link
Member

acrobat commented Nov 11, 2019

What is the actual namespace (fqcn) of the class you want register as a receiver?

@anthipapa
Copy link
Author

App\BackgroundTasks, so theoretically it should be App\BackgroundTasks\Receiver for the class

@acrobat
Copy link
Member

acrobat commented Nov 11, 2019

Can you paste the content of the receiver class?

@anthipapa
Copy link
Author

After your question I tried both an empty class, and a basic function. Is there specific content the class should have for it to work?

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

2 participants