Skip to content
New issue

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

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

Already on GitHub? # to your account

Upcoming 2.0 #743

Merged
merged 61 commits into from
Apr 15, 2018
Merged

Upcoming 2.0 #743

merged 61 commits into from
Apr 15, 2018

Conversation

goetas
Copy link
Collaborator

@goetas goetas commented Apr 7, 2017

The intent is to cleanup the core, keeping it compatible with the public api for the majority of cases.

There will be no killing feature, but mainly closing a big list of annoying bugs and unexpected behaviors that are present in the 1.x versions.
After many year, some bugs become features and many developers found workarounds that were relying on those bugs... the 2.0 release will be mainly a cleaning release.

The goal is to allow upgrading transparently from 1.x to 2.x serializer in "standard" use-cases, including customizations as custom subscribing handlers, event listeners, exclusion strategies.

Features and bugfixes

Here a list of features, enhancements and bugfixes that will be introduced with the 2.0 release (not all are yet confirmed)

Breaking changes

  • Removed the abstract classes GenericSerializationVisitor and GenericDeserializationVisitor, extend the specific visitor instead.
  • Added GraphNavigatorInterface interface, changed method signatures to use GraphNavigatorInterface instead of GraphNavigator class
  • GraphNavigator is an abstract class now and is ony for internal proposes
  • Removed deprecated method VisitorInterface::getNavigator() from all the visitors, use Context::getNavigator() instead
  • Removed deprecated method JsonSerializationVisitor::addData, use JsonSerializationVisitor::setData instead
  • Removed Propel and PhpCollection support
  • Changed default date format from ISO8601 to RFC3339
  • Event listeners/handlers class names are case sensitive now
  • Changed default "serializeNull" value from NULL to false
  • Removed Context::accept() method, use Context::getNavigator()->accept()
  • Removed AbstractVisitor::getNamingStrategy() method from all the visitors
  • Removed Symfony 2.x support
  • Removed PHP Driver metadata support
  • Removed in-object handler callbacks, use event listeners instead
  • Deprecated VisitorInterface, use SerializationVisitorInterface and DeserializationVisitorInterface instead
  • Changed SerializerInterface::serialize signature to serialize($data, $format, SerializationContext $context = null, $type = null)
  • Changed ArrayTransformerInterface::toArray signature to toArray($data, SerializationContext $context = null, $type = null);
  • Removed Context::initialize, use DeserializationContext::initialize and SerializationContext::initialize
  • Removed Serializer::setSerializationContextFactory and Serializer::setDeserializationContextFactory, context factories are now constructor parameters
  • Marked as final many classes, use composition over inheritance
  • PHP 7.2 is the minimum PHP version

In which situations transparent upgrade will not work?

Transparent upgrades probably are not possible if:

  • you have extended in your application a "visitor" or implemented a custom one
  • you have extended the main class Serializer re-implementing the serialize or toArray method
  • you have re-implemented SerializerInterface or ArrayTransformerInterface
  • implemented ObjectConstructorInterface
  • extended one of the internal classes, now marked as final (always prefer composition over extension) (list will be available soon)

Github issues

Doing a quick analysis of the currently listed github "issues" for the jms serializer and jms serializer bundle i found out that:

  • 40% are support requests (many duplicates)
  • 30% are bugs or unexpected behaviors (many duplicates)
  • 20% are feature requests (some duplicates)
  • Mixed stuff

The 2.0 release should close at least 40 tickets

Todo

Issues:

@TNAJanssen
Copy link

What is the ETA of version 2.0?

@goetas
Copy link
Collaborator Author

goetas commented Aug 11, 2017

there is not really.
I'm not sure that the benefits are worth the BC break.

@goetas goetas force-pushed the 2.0 branch 2 times, most recently from a41c4a6 to 2729037 Compare February 16, 2018 17:42
@goetas
Copy link
Collaborator Author

goetas commented Feb 16, 2018

Wohooo! Rebased

@goetas goetas force-pushed the 2.0 branch 3 times, most recently from 48e41d4 to e6f5709 Compare February 16, 2018 18:13
@Tobion
Copy link
Contributor

Tobion commented Feb 17, 2018

thanks for working on this. On my wishlist performance improvements would come first. We use jms serializer heavily for an api. and the jms serializer is taking a huge chunk of the response time for big object graphs due to its graph navigator pattern. so if there was a way to make the serializer faster for 2.0, even if it means removing some uncommon features, that would be cool. we mostly use versioning, groups and virtual properties. i don't know if there is potential for improvement when you don't need event listeners for example. do you have any plans in this regard?

@goetas
Copy link
Collaborator Author

goetas commented Feb 17, 2018

Thanks for the feedback! Actually #875 and #861 bring already a ~10% of improvements already in the 1.x serie.

@goetas
Copy link
Collaborator Author

goetas commented Feb 17, 2018

Regarding your setup, to get the best performance make sure to have a look to #760 and #684.

They default values gives you the worst performance, this because the aim is guarantee 100% of backward compatibility, but setting:

$skipVirtualTypeInit = true;
$initializeExcluded = false;

In some cases i got even 300% of performance improvements without doing anything else...

If you are using the symfony-bundle v2.x, then you are already benefiting the optimized values.

@goetas goetas force-pushed the 2.0 branch 2 times, most recently from 5416310 to 87874d6 Compare February 18, 2018 10:47
@goetas goetas force-pushed the 2.0 branch 2 times, most recently from 399cc6f to 1c2494a Compare March 31, 2018 07:35
@goetas
Copy link
Collaborator Author

goetas commented Apr 4, 2018

blackfire
Current status 🎉

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants