Devdocs: Missing out-of-the-box event reference in Events and observers topic

Created on 24 Jul 2020  路  26Comments  路  Source: magento/devdocs

General issue

Description

The documentation is missing a reference of events which come with Magento out of the box.

Possible solutions

Include an official list and description of events would be most welcome.

Additional information

These could be an inspiration:

Even better if the official reference contained also a human description of when the events are emitted.

Automation dev in progress

All 26 comments

Hi @Lennonka. Thank you for your report.
To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


@shrielenee Will a new topic with all the events work? I can work on it

Hey @goivvy --- Yep! We would love if you would work on it. 馃専

@magento I am working on this

Love you for working on this!

Please see a screenshot - would this layout be informative enough? I'd like to use it for the rest 300+ events, thought I'd ask first.
Screen Shot 2020-11-20 at 5 04 19 PM

@shrielenee Could you take a look, please?

Hey @goivvy Do you have an open or in-progress PR for this? It's easier to review that way. Calling in some reinforcements... paging @keharper 馃摬

This request is a job for automation. Any manually gathered list could be out of date the next patch release, and we can't search the code base every time we release a patch or add new functionality to the code base.

@dshevtsov Does this look like something we can automate?

@keharper, I think so, but I will need time to explore available options.
cc @jeff-matthews

Here is what I did:

  1. Downloaded the latest Magento release
  2. find vendor -type f -exec grep -iHn --color=always '->dispatch(' {} \; >eventlist.txt
  3. Went over eventlist.txt manually and store all event names in DB.

It is also possible to gather all event names automatically but I thought manually collecting them would be more accurate (dispatch call takes several lines in some cases + event name might be dynamic so it might take some time to write a script that would address all cases).

@keharper as per your concerns I don't mind updating the list every new release as it wouldn't take long (I can always diff older vs new version and grep every dispatch call out of trace). Plus we need to fill where/what/when to listen sections, those would be hard to automate.

@shrielenee @dshevtsov @keharper Should I continue going over the events manually?

It depends on what level of detail you want.

A simple overview of events can be done by using a regular expression. If you want some more detail then it'd quickly go to using some kind of AST to determine what is e.g. passed as data to the event.

An AST might be over-engineering the problem but at the same time feels like to only viable solution which can also be automated.

What do you think @goivvy?

I'd root for a manual approach, that way it would be more accurate and I can add usage (when to listen) details which would be impossible to compose automatically.

Unfortunately, manual approach would require manual reapplying for each new release.
We added this request to the list of automation requests in our backlog.

That's 20 hours of my time wasted down the drain. Thank you.

@goivvy, since we have encouraged you to work on this pull request and you have already done great work, it makes perfect sense to publish it and keep until we come up with the automation. We'll need to add corresponding notes referring to the documented components (code repositories such as magento2, inventory, etc) and versions of the code.

@shrielenee , @keharper what do you think?

I concur.

OK.

Will you keep my top 'thank you' backlink once you adopt an automated page?

@keharper

@dshevtsov @keharper @shrielenee Could you please answer my question before I move forward?

@goivvy, yes, we'll preserve the backlink in honor of your original contribution.

Hi @goivvy Did a PR ever come of this? It would be great to publish it.

@dobooth I'm still working on it. 50+ events to go. Do you want me to push what's been already done and put the rest is coming up shortly notice at the bottom?

@dobooth
Screen Shot 2021-03-25 at 5 02 06 PM

@dobooth Could you comment on it?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sreichel picture sreichel  路  4Comments

terryx picture terryx  路  6Comments

sanganinamrata picture sanganinamrata  路  5Comments

Eddcapone picture Eddcapone  路  7Comments

Lewiscowles1986 picture Lewiscowles1986  路  6Comments