Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear documentation for read-only entity extension fields #498

Closed
dallyger opened this issue Feb 25, 2022 · 4 comments
Closed

Unclear documentation for read-only entity extension fields #498

dallyger opened this issue Feb 25, 2022 · 4 comments
Assignees
Labels
Core @ct-core Improvement PR created to append/modify info in the existing article

Comments

@dallyger
Copy link
Contributor

I wanted to create an entity extension containing a "field without database" but got confused by the docs.
There are so many open questions and assumptions.

What are the field-types for? It seems to have no effect if I use a "BoolField", "StringField" or anything else.

What should I add as an extension? "Please note that its second parameter [...] has to be a struct" is too unspecific.

And what does the customString-value from the example do? Doesn't get used anywhere.

Also, the example doesn't add up it seems.

Here it gets defined as a StringField:

(new StringField('custom_string', 'customString'))->addFlags(new Runtime())

But later on, it gets assigned an ArrayStruct?

$productEntity->addExtension('custom_string', new ArrayEntity(['foo' => 'bar']));

When I follow it, it works but is confusing as hell, when I look at the dump of the entity:

#extensions: array:1 [
    "custom_string" => Shopware\Core\Framework\Struct\ArrayEntity {[#2836]()
      #data: array:1 [
        "foo" => "bar"
      ]
      #_entityName: "array-entity"
      #_uniqueIdentifier: null
      #versionId: null
      #translated: []
      #createdAt: null
      #updatedAt: null
      #extensions: []
      -_entityName: null
    }
  ]

Here, custom_string is not the name of the field as expected, but of the extension? How can it be defined as a "StringField" but not return a string?

@dallyger
Copy link
Contributor Author

Hi @PaddyS, can you help me here?
Sorry for contacting you directly, but getting ignored on every official channel is pretty frustrating, and you've added the example in the first place. So I didn't know who else to contact.

@elkmod elkmod added Improvement PR created to append/modify info in the existing article Core @ct-core labels Apr 27, 2022
@dallyger
Copy link
Contributor Author

Hi there, a full year has passed. Any updates on this one?

@sushmangupta
Copy link
Collaborator

@dallyger , thanks for raising this issue and sorry for the delayed response.
We have internally created a ticket to address your concern. We shall be working on this going forward.

@Isengo1989
Copy link
Collaborator

@dallyger we removed the confusing part. Thank you for the hint 👍

#1302

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core @ct-core Improvement PR created to append/modify info in the existing article
Projects
None yet
Development

No branches or pull requests

4 participants