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

Create documentation on how to listen to API signals

    Details

    • Epic Link:
    • Sprint:
      Aconcagua Sprint 3
    • Story Points:
      1

      Description

      Documentation should explain how to :

      • Register slots for a given signal.
      • Use the Symfony event listeners/subscribers to react on signals.

        Issue Links

          Activity

          Show
          Jérôme Vieilledent (Inactive) added a comment - https://confluence.ez.no/display/EZP/How+to+listen+to+Core+events
          Hide
          Marcos Loureiro (Inactive) added a comment -

          Is it possible to register the slot to listen on all signals from a service?

          something like:

              - { name: ezpublish.api.slot, signal: ContentService\* }

          or something like:

              - { name: ezpublish.api.slot, signal:[ ContentService\CreateContentSignal , ContentService\CreateContentDraftSignal , ... ]

          The above examples don't work, is there any way to achieve the above ideas?

          Show
          Marcos Loureiro (Inactive) added a comment - Is it possible to register the slot to listen on all signals from a service? something like: - { name: ezpublish.api.slot, signal: ContentService\* } or something like: - { name: ezpublish.api.slot, signal:[ ContentService\CreateContentSignal , ContentService\CreateContentDraftSignal , ... ] The above examples don't work, is there any way to achieve the above ideas?
          Hide
          Jérôme Vieilledent (Inactive) added a comment -

          Is it possible to register the slot to listen on all signals from a service?

          Not like you show (or it would have been documented obviously...). However you should be able to repeat the tags.

          Show
          Jérôme Vieilledent (Inactive) added a comment - Is it possible to register the slot to listen on all signals from a service? Not like you show (or it would have been documented obviously...). However you should be able to repeat the tags.
          Hide
          Marcos Loureiro (Inactive) added a comment - - edited

          You're right, just created more tags and it worked as expected.

          Edit:
          adding several tags as:

          services:
              my_signal_slot:
                  class: my\SignalSlotBundle\Slot\OnContentServiceSignalSlot
                  arguments: [ @ezpublish.api.service.content ]
                  tags:
                      - { name: ezpublish.api.slot, signal: ContentService\CreateContentDraftSignal }
                      - { name: ezpublish.api.slot, signal: ContentService\CreateContentSignal }
                      - { name: ezpublish.api.slot, signal: ContentService\PublishVersionSignal }
          

          Will make that only the first is taken in account, am I doing anything wrong?

          Executed: Create content
          Executed: Publish content
          eZ\Publish\Core\SignalSlot\Signal\ContentService\CreateContentDraftSignal Object
          (
              [contentId] => 80
              [versionNo] => 
              [userId] => 
          )
          Executed: Create draft
          Executed: Update content
          Executed: Add relation
          Executed: Remove relation
          Executed: Copy content
          Executed: Update metadata
          Executed: Translate
          Executed: Add Translation Info
          Executed: Remove version 2 (latest)
          Executed: Remove content
          

          As seen above only "CreateContentDraftSignal" was taken in account.

          Show
          Marcos Loureiro (Inactive) added a comment - - edited You're right, just created more tags and it worked as expected. Edit: adding several tags as: services: my_signal_slot: class: my\SignalSlotBundle\Slot\OnContentServiceSignalSlot arguments: [ @ezpublish.api.service.content ] tags: - { name: ezpublish.api.slot, signal: ContentService\CreateContentDraftSignal } - { name: ezpublish.api.slot, signal: ContentService\CreateContentSignal } - { name: ezpublish.api.slot, signal: ContentService\PublishVersionSignal } Will make that only the first is taken in account, am I doing anything wrong? Executed: Create content Executed: Publish content eZ\Publish\Core\SignalSlot\Signal\ContentService\CreateContentDraftSignal Object ( [contentId] => 80 [versionNo] => [userId] => ) Executed: Create draft Executed: Update content Executed: Add relation Executed: Remove relation Executed: Copy content Executed: Update metadata Executed: Translate Executed: Add Translation Info Executed: Remove version 2 (latest) Executed: Remove content As seen above only "CreateContentDraftSignal" was taken in account.
          Hide
          Marcos Loureiro (Inactive) added a comment -

          QA Approved

          Show
          Marcos Loureiro (Inactive) added a comment - QA Approved

            People

            • Assignee:
              Unassigned
              Reporter:
              Jérôme Vieilledent (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 4 hours Original Estimate - 4 hours
                4h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 4 hours, 30 minutes
                1d 4h 30m

                  Agile