OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions SearchBundle + my entities

This topic contains 2 replies, has 2 voices, and was last updated by  Yurii Muratov 5 years, 1 month ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
  • #33912



    Please I need some help. I’m trying to add 3 entities that I created using migrations on Oro Global Search (SearchBundle). Already created my search.yml and my search_template as well. The search is working partially but I have problems passing parameters to my route and also getting problems to show up my template on the search results.

    1) In SearchController.php looks like it’s ignoring my search.yml/parameters. I don’t want to pass to my route the RecordID but a custom field called: ‘custno’.

    Basically on OroSearchBundle:Search:searchSuggestion.html.twig it’s generating a link with this structure:
    acme.dev/app_dev.php/testbundle/accounts/view/{RECORD_ID} and I want {custno}

    All search.yml examples that I found are using “parameters: id: id”. So, I’m not sure if it’s a bug or if I am doing something wrong.

    2) Looks like the search is ignoring my search_template:

    This is my search.yml:

    and this is my “Search:result.html.twig”

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #33913


    Hi there! Managed to fix. Debugging the event_dispatcher I found the problem. It was referencing to a wrong record_id on table oro_search_item.

    Problem 1:
    Basically I had to remove the entity alias from parameters field name and run the command to reindex.

    php app/console oro:search:reindex "Acme\Bundle\TestBundle\Entity\TestAccounts"

    *** if you run this command without double quotes it’s gonna generate error.

    Problem 2:
    Had to set the variables: “title” and “entityType”
    {% set title = entity.contact %}
    {% set entityType = 'acme_test.accounts.entity.label'|trans %}

    I hope this information could help someone else with the same problem.


    Yurii Muratov

    Hi, @rbandeira.

    Problem 1.
    Yes. In search.yml file, at the route parameters you should not write entity alias from the alias parameter. Just a field name of your entity.

    Problem 1.1.
    You should add quotes at parameters if you set full class name. But you can use short entity name parameter, in your case it will be AcmeTestBundle:TestAccounts. In this it is not necessary to add case quotes.

Viewing 2 replies - 1 through 2 (of 2 total)

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

You will be redirected to [title]. Would you like to continue?

Yes No