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

Serializing an entity immediately after creating it results in an error #90

Open
daniel-memo-ict opened this issue Jan 16, 2024 · 2 comments

Comments

@daniel-memo-ict
Copy link

Steps

  1. Create an entity (Any entity, doesn't matter which one, Address, Barcode, Contact,etc)
  2. pass it through json_encode.

Expected behavior:
Returns a json encoded string of all the properties available in the entity

Actual behavior:
Throws an exception

What exactly is currentService being used for? Currently I can only see it being set, and not being read anywhere except to throw the mentioned exception. getCurrentService() does not seems to be used.
And why must it be set if it's not used anywhere?
If it is absolutely necessary to have, can the check be moved elsewhere so it doesn't interfere with the simple process of serializing the entity's properties?

@firstred
Copy link
Owner

I believe it used to provide some serialization context for the SOAP API, equivalent to the context of a Symfony Serializer. It somehow ended up in the entity itself rather than on the serializer. Now that support for the SOAP API has been dropped it is no longer necessary, I think.

Do you think it can be removed in its entirety? It would be nice to get rid of legacy code like this.

@daniel-memo-ict
Copy link
Author

In theory, as I don't see it being used anywhere, it should be possible to remove it entirely without affected anything else in the package. I of course don't know if there are any implementations that may use the currentService property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants