Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-26086

Unable to inject additional service or value into QueryType as a service

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: High High
    • Resolution: Fixed
    • Affects Version/s: 1.4.0, 1.4.1
    • Fix Version/s: 1.5.0, 1.4.2
    • Component/s: None
    • Labels:
      None

      Description

      When working with QueryType as a service, it's impossible to inject anything into this service using constructor or setter (Symfony `caller` method).

      I was trying to create a new QueryType as a service on ezplatform-demo to use it for displaying blog posts on Top Stories section.

      I was trying to inject languages array via Symfony caller method:

      app.blog_posts_query_type:
          class: AppBundle\QueryType\BlogPostsQueryType
          calls:
              - [setLanguages, ["$languages$"]]
          tags:
              - { name: ezpublish.query_type }
      

      Unfortunately setLanguages method is never fired.

      Same for passing variables via constructor - it doesn't work.

        Activity

        Hide
        Bertrand Dunogier added a comment -

        After testing, it indeed seems that this ain't working as expected.

        As far as I can tell, it had been fixed in the prototype PR I had done, and was forgotten when it was submitted again: https://github.com/ezsystems/ezpublish-kernel/pull/1473.

        As I see it, any QueryType class that is registered as a service should be ignored by the convention based registration process. It was working before, as I had ran into exactly this problem when using the feature.

        I'll try to fix it this week.

        Show
        Bertrand Dunogier added a comment - After testing, it indeed seems that this ain't working as expected. As far as I can tell, it had been fixed in the prototype PR I had done, and was forgotten when it was submitted again: https://github.com/ezsystems/ezpublish-kernel/pull/1473 . As I see it, any QueryType class that is registered as a service should be ignored by the convention based registration process. It was working before, as I had ran into exactly this problem when using the feature. I'll try to fix it this week.
        Hide
        Rafał Toborek (Inactive) added a comment -

        Thanks Bertrand.

        Show
        Rafał Toborek (Inactive) added a comment - Thanks Bertrand.
        Hide
        Bertrand Dunogier added a comment - - edited

        PR https://github.com/ezsystems/ezpublish-kernel/pull/1735.

        Can you give it a try [~rafal.toborek@ez.no] ?

        Show
        Bertrand Dunogier added a comment - - edited PR https://github.com/ezsystems/ezpublish-kernel/pull/1735 . Can you give it a try [~rafal.toborek@ez.no] ?
        Hide
        Rafał Toborek (Inactive) added a comment -

        Works great, thanks Bertrand

        Show
        Rafał Toborek (Inactive) added a comment - Works great, thanks Bertrand
        Hide
        Rui Silva (Inactive) added a comment -

        Tested and approved by QA for master.

        Show
        Rui Silva (Inactive) added a comment - Tested and approved by QA for master.

          People

          • Assignee:
            Unassigned
            Reporter:
            Rafał Toborek (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: