devdocs icon indicating copy to clipboard operation
devdocs copied to clipboard

Missing example for scalar attributes

Open ioweb-gr opened this issue 3 years ago • 5 comments

New topic request

Please add an example for a scalar attribute and how to persist in database at https://devdocs.magento.com/guides/v2.4/extension-dev-guide/extension_attributes/adding-attributes.html

Description

The docs accurately describe how to add non scalar attributes but there's no clear example for scalar attributes. Should we add them as a table column, as an attribute or always use as a separate table? What's the proper implementation to follow for extension attributes?

Content checklist

  • [ ] The topic provides an explanation of how adding scalar extension attributes works.
  • [ ] The topic provides steps for persisting scalar attributes in the database.
  • [ ] The topic contains code samples that shows plugins for a scalar attribute and scalar attribute array use case.

Additional information/resources

As it is now it seems that we can just add the xml declaration, use the attributes and they will automatically get saved in the database which is not the case. I browsed many questions on stackexchange about this with the same confusion.

Moreover there are no guidelines to promote a good usage example so everyone will implement as he sees fit

ioweb-gr avatar Jan 04 '22 13:01 ioweb-gr

Hi @ioweb-gr. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.

Add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Jan 04 '22 13:01 m2-assistant[bot]

@ioweb-gr - You need to provide the relevant page links for the "The docs accurately describe how to add non scalar attributes" statement - otherwise we cannot review and determine what examples should be give (if any)

You'll need to do this in the next few days or we'll have to close the issue as currently it is incomplete.

Thanks!

BarnyShergold avatar Jan 07 '22 14:01 BarnyShergold

Oh, I clicked on the devdocs page and pressed report an issue, I'm wondering why it didn't get the title :( https://devdocs.magento.com/guides/v2.4/extension-dev-guide/extension_attributes/adding-attributes.html

ioweb-gr avatar Jan 07 '22 14:01 ioweb-gr

Oh, I clicked on the devdocs page and pressed report an issue, I'm wondering why it didn't get the title :( https://devdocs.magento.com/guides/v2.4/extension-dev-guide/extension_attributes/adding-attributes.html

Can you add this to the PR description please? So it's easy for the person doing the task to get the information? things can get lost in comments :)

BarnyShergold avatar Jan 17 '22 14:01 BarnyShergold

Sure , how about now?

ioweb-gr avatar Jan 17 '22 15:01 ioweb-gr