sonata-project / SonataCoreBundle

[deprecated] SonataCoreBundle
MIT License
318 stars 138 forks source link

What should we do with the serializer namespace? #733

Closed greg0ire closed 4 years ago

greg0ire commented 4 years ago

Dependents of this namespace include:

Documentation can be found at https://github.com/sonata-project/SonataCoreBundle/blob/c1bbd519481c58ed787527d9b48c7a8238c23107/docs/reference/serialization.rst

TL;DR: it's about serializing/deserializing an object to/from its id + a manager (meaning a persistence manager)

The only 3 solutions I see are:

a) create a package with the 2 types b) copy the 2 types to all of the 4 packages above c) drop features related to this (I have no idea how useful they are)

I'm reluctantly leaning towards a), what about you?

core23 commented 4 years ago

I'm for solution 2, because it's no common problem / component

wbloszyk commented 4 years ago

a) - make reusable package for 2 types (depends of. "jms_serializer.subscribing_handler" is bad idea.

b) - OK

c) - If we dont how useful od it, then b look event better

What about d ? Move serializer to form-extensionds. It will be used in all 4 bundles. Also look at BaseDoctrineORMSerializationType. It look like is both are related to jms_serializer. Ecommerce basket API form can be example.

greg0ire commented 4 years ago

API form

Oh so this serializer is used in APIs that are used to display forms?! If yes d) sounds like a really great option.

wbloszyk commented 4 years ago

API form

Oh so this serializer is used in APIs that are used to display forms?! If yes d) sounds like a really great option.

It look like every *Type extends Base BaseDoctrineORMSerializationType base on API. Also all this Types have handlers extends BaseSerializerHandler.

@greg0ire can u check it too, to be sure in 100%? I'm on phone now.

greg0ire commented 4 years ago

Looks correct:

``` rg BaseDoctrineORMSerializationType [Ss]onata* SonataCoreBundle/CHANGELOG.md 306:- Fixed `BaseDoctrineORMSerializationType::buildForm` compatibility with Symfony3 forms SonataCoreBundle/UPGRADE-3.0.md 44:These classes will be remove use respectively ``BaseDoctrineORMSerializationType`` and ``BaseStatusType`` sonata-form-extensions/CHANGELOG.md 23:- Remove `BaseDoctrineORMSerializationType::setDefaultOptions` sonata-form-extensions/composer.json 50: "doctrine/persistence": "If you want to use BaseDoctrineORMSerializationType" SonataCoreBundle/docs/reference/form_types.rst 43: ``BaseDoctrineORMSerializationType`` with an empty class to have a sonata-form-extensions/docs/reference/form_types.rst 43: ``BaseDoctrineORMSerializationType`` with an empty class to have a sonata-form-extensions/src/Type/BaseDoctrineORMSerializationType.php 31:class BaseDoctrineORMSerializationType extends AbstractType SonataClassificationBundle/src/Form/Type/ApiTagType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiTagType extends BaseDoctrineORMSerializationType SonataClassificationBundle/src/Form/Type/ApiContextType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiContextType extends BaseDoctrineORMSerializationType SonataClassificationBundle/src/Form/Type/ApiCategoryType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiCategoryType extends BaseDoctrineORMSerializationType SonataClassificationBundle/src/Form/Type/ApiCollectionType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiCollectionType extends BaseDoctrineORMSerializationType SonataCoreBundle/src/Form/Type/BaseDoctrineORMSerializationType.php 32:class BaseDoctrineORMSerializationType extends AbstractType SonataMediaBundle/src/Form/Type/ApiGalleryItemType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 21:class ApiGalleryItemType extends BaseDoctrineORMSerializationType SonataMediaBundle/src/Form/Type/ApiGalleryType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 21:class ApiGalleryType extends BaseDoctrineORMSerializationType SonataMediaBundle/src/Form/Type/ApiDoctrineMediaType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 21:class ApiDoctrineMediaType extends BaseDoctrineORMSerializationType sonata-ecommerce/src/BasketBundle/Form/ApiBasketElementParentType.php 16:use Sonata\CoreBundle\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiBasketElementParentType extends BaseDoctrineORMSerializationType sonata-ecommerce/src/BasketBundle/Form/ApiBasketParentType.php 16:use Sonata\CoreBundle\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiBasketParentType extends BaseDoctrineORMSerializationType SonataNewsBundle/src/Form/Type/ApiCommentType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 21:class ApiCommentType extends BaseDoctrineORMSerializationType SonataNewsBundle/src/Form/Type/ApiPostType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 21:class ApiPostType extends BaseDoctrineORMSerializationType SonataNotificationBundle/src/Form/Type/MessageSerializationType.php 16:use Sonata\CoreBundle\Form\Type\BaseDoctrineORMSerializationType; 18:class MessageSerializationType extends BaseDoctrineORMSerializationType SonataPageBundle/src/Form/Type/ApiPageType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiPageType extends BaseDoctrineORMSerializationType SonataPageBundle/src/Form/Type/ApiSiteType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiSiteType extends BaseDoctrineORMSerializationType SonataPageBundle/src/Form/Type/ApiBlockType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiBlockType extends BaseDoctrineORMSerializationType SonataUserBundle/src/Form/Type/ApiGroupType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiGroupType extends BaseDoctrineORMSerializationType SonataUserBundle/src/Form/Type/ApiUserType.php 16:use Sonata\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiUserType extends BaseDoctrineORMSerializationType SonataCoreBundle/src/CoreBundle/Form/Type/DoctrineORMSerializationType.php 21:class DoctrineORMSerializationType extends BaseDoctrineORMSerializationType SonataCoreBundle/src/CoreBundle/Form/Type/BaseDoctrineORMSerializationType.php 16:if (!class_exists(\Sonata\Form\Type\BaseDoctrineORMSerializationType::class, false)) { 18: 'The '.__NAMESPACE__.'\BaseDoctrineORMSerializationType class is deprecated since version 3.13.0 and will be removed in 4.0.' 19: .' Use Sonata\Form\Type\BaseDoctrineORMSerializationType instead.', 25: \Sonata\Form\Type\BaseDoctrineORMSerializationType::class, 26: __NAMESPACE__.'\BaseDoctrineORMSerializationType' 33: class BaseDoctrineORMSerializationType extends \Sonata\Form\Type\BaseDoctrineORMSerializationType sonata-ecommerce/src/CustomerBundle/Form/Type/ApiAddressType.php 16:use Sonata\CoreBundle\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiAddressType extends BaseDoctrineORMSerializationType sonata-ecommerce/src/CustomerBundle/Form/Type/ApiCustomerType.php 16:use Sonata\CoreBundle\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiCustomerType extends BaseDoctrineORMSerializationType sonata-ecommerce/src/ProductBundle/Form/Type/ApiProductParentType.php 16:use Sonata\CoreBundle\Form\Type\BaseDoctrineORMSerializationType; 18:class ApiProductParentType extends BaseDoctrineORMSerializationType ```
wbloszyk commented 4 years ago

@core23 WDYT?