Closed bettinz closed 8 years ago
I'll add a note about Symfony 3 in documentation. Assetic is still available, just install it (or do not use it, it's not mandatory)
The documentation example still shows the Symfony2 approach. There seems to be a hint about Symfony3
In your FormType, change field type from
entity
toautocomplete
which at least would make sense in Symfony3 like this.
->add('name', 'autocomplete')
But it doesn't work. Instead it throws a
500 Could not load type "autocomplete"
exception. So another way in Symfony3 would be something like this
use PUGX\AutocompleterBundle\Form\Type\AutocompleteType;
...
->add('author', AutocompleteType::class, array(...))
but this throws a 500 Option "class" must be set
exception as this constant seems to be unset.
And finally using the legacy method like this
->add('author', 'PUGX\AutocompleterBundle\Form\Type\AutocompleteType', array(
'class'=>'AppBundle\Entity\Author'
))
throws a
500 Call to a member function getId() on string
Stack Trace in
vendor\pugx\autocompleter-bundle\Form\Transformer\ObjectToIdTransformer.php
at line 44
return '';
}
return $object->getId();
}
I recommend to reopen this issue and collaboratively take a look into this and keep the documentation up to date...
Or maybe I'm just missing something out here. In that case I'd be happy for a heads up :smiley:
The error about ::class
is your fault, you need a newer version of PHP. The last option you used, the one with the FQCN, is the one currently proposed by the docs, and it's supposed to work. Feel free to open an issue if you're able to create a situation where the bug is reproducible
Hm, I'm using Symfony version 3.1.5 and PHP 7.0.6. What PHP version is required?
Sorry, the error is not about ::class
, is about class
option missing
I have same problem.
Sorry, the error is not about
::class
, is aboutclass
option missing
@FacundoVelazco feel free to open an issue when you explain how to reproduce
Hello, I'm using Symfony 3. In FormType 'autocomplete' doesn't work
I need to use
Also, Assetic is not available anymore, so
doesn't work. Are known problems? Thank you