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

Im asking for help : #2

Open
janfuri opened this issue Apr 11, 2018 · 1 comment
Open

Im asking for help : #2

janfuri opened this issue Apr 11, 2018 · 1 comment

Comments

@janfuri
Copy link

janfuri commented Apr 11, 2018

I'd like to ask for help with implementation of your code.
I got stuck on the last point

Then just use the MakinaCorpus\AutocompleteBundle\Form\Type\TextAutocompleteType form type in your own form builders, and set the source class name as the source parameter for the form type.

In my controller I have :
->add('fullname', TextAutocompleteType::class, array('source' => TextType::class))

but I get error :

An exception has been thrown during the rendering of a template ("Symfony\Component\Form\Extension\Core\Type\TextType: cannot find class or service").

In the top of my controller I have already added lines :

use MakinaCorpus\AutocompleteBundle\Form\Type\TextAutocompleteType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
@janfuri janfuri closed this as completed Apr 11, 2018
@janfuri janfuri reopened this Apr 11, 2018
@pounard
Copy link
Member

pounard commented Jun 19, 2018

Hello, I'm really sorry I didn't see your issue before (I wasn't watching my own project...).

The 'source' argument must be an existing class name which implements the \MakinaCorpus\AutocompleteBundle\Autocomplete\AutocompleteSourceInterface interface, and which must be registered as a service in your container with the 'autocomplete.source' tag.

There is no magic or dynamic other way of registering autocomplete sources, they have to exist into your container, and be public.

Hope this helps, please ask any further question if you need more help.

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