This topic contains 1 reply, has 2 voices, and was last updated by Yevhen Shyshkin 8 years, 1 month ago.
- Topic
Hi,
I’m trying to create a select form type to list all values from an entity but i got an error :
1request.CRITICAL: Uncaught PHP Exception RuntimeException: "Cannot init search alias for entity "Bga\Bundle\SalesBundle\Entity\ActivityCategory".When I dump the $config parameter in SearchHandler::initSearchIndexer before error thrown I don’t see the ‘Bga\Bundle\SalesBundle\Entity\ActivityCategory’ key that is the entity I’m trying to retrieve.
Am I missing something ?
First in workflow transition :
1234567form_options:attribute_fields:activitycategory:form_type: bga_sales_activitycategory_selectoptions:required: truelabel: 'Choose'Form type in Bundle/Form/Type/ActivityCategorySelectType.php :
12345678910111213141516171819202122232425262728293031323334353637383940<?phpnamespace Bga\Bundle\SalesBundle\Form\Type;use Symfony\Component\Form\AbstractType;use Symfony\Component\OptionsResolver\OptionsResolverInterface;class ActivityCategorySelectType extends AbstractType{/*** {@inheritdoc}*/public function setDefaultOptions(OptionsResolverInterface $resolver){$resolver->setDefaults(['autocomplete_alias' => 'activitycategories','configs' => ['placeholder' => 'bgasales.activitycategory.form.choose_activitycategory','selection_template_twig' => 'OroFormBundle:Autocomplete:fullName/selection.html.twig'],]);}/*** {@inheritdoc}*/public function getParent(){return 'oro_entity_create_or_select_inline';}/*** {@inheritdoc}*/public function getName(){return 'bga_sales_activitycategory_select';}}And finally serach handler and form type services :
In form.yml :1234bga_sales.form.type.activitycategory_select:class: %bga_sales.form.type.activitycategory_select.class%tags:- { name: form.type, alias: bga_sales_activitycategory_select }And in services.yml :
12345678bga_sales.form.autocomplete.activitycategory.search_handler:parent: orocrm_channel.autocomplete.channel_limitation_handlerarguments:- %bga_sales.activitycategory.entity.class%- ["label"]tags:- { name: oro_form.autocomplete.search_handler, alias: activitycategories, acl_resource: bga_sales_prospect_view }lazy: true
The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.