-
-
Notifications
You must be signed in to change notification settings - Fork 585
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
Allow Post Serialize Event to overwrite existing data #273
Conversation
this will not be very useful without a way to know whether you have the data already to choose between add and replace. IMO, replace should not check whether the data is already there (you don't really care as it would be data being dropped anyway) |
@stof Indeed you are right, I have removed the check. |
* Allows you to replace existing data on the current object/root element. | ||
* | ||
* @param string $key | ||
* @param scalar|array $value This value must either be a regular scalar, or an array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scalar|array|null
would be better (null
is not a scalar in PHP)
I copied the docblock from the |
I'm curious if this is still being actively pursued? :) |
@schmittjoh Can you please take a look at my PR and give some feedback or merge it? Thx! |
It would be nice if this is in, currently we use the fork because we need it... |
👍 |
2 similar comments
👍 |
👍 |
👍 Really useful |
👍 |
@schmittjoh Can you review this PR? Thx |
👍 |
1 similar comment
+1 |
* master: (77 commits) use explicit boolean comparison Added tests to ensure SerializeNull policy Revert "Default `$serializeNull` to false" Start with the 1.3.x branch Added tests for 'hasData' $context is not used Fix Doctrine PHPCR ODM 2.0 compatibility Start with the 1.2.x branch added hhvm-nightly Make tests working on HHVM Use camel case for skipWhenEmpty annotation Lookup for local namespaces when creating elements Use always xpath to find nodes, when the namespace is empty, simplexml fails Allow to decide when skip empty arrays when serializing to xml Added skip_when_empty xml collection option Do not skip empty not inline array root node Allow to use custom serializer with primitive type Composer is not able to resolve a dependency Fix xml-attribute-map for the xml driver makes sure that explicit lists are serialized as lists ...
@goetas I have merged the master branch again, so you can merge this PR. |
@jockri tnx! |
The GenericSerializationVisitor throws an exception when trying to add a data field that already exists. This PR makes it possible to change existing data for serialization purposes by adding the
replaceData
method.Solves issue: #129