gollumsf/serializer-describe-annotation-bundle

Add class annotation for describe serializer property

v2.0.1 2023-06-17 23:28 UTC

This package is auto-updated.

Last update: 2024-11-19 12:44:24 UTC


README

Build Status Build Status Build Status

Coverage License Latest Stable Version Latest Unstable Version Discord

Add class annotation for describe serializer property

Installation:

composer require gollumsf/serializer-describe-annotation-bundle

config/bundles.php

return [
    // [ ... ]
    GollumSF\SerializerDescribeAnnotationBundle\GollumSFSerializerDescribeAnnotationBundle::class => ['all' => true],
];

Usage

use GollumSF\SerializerDescribeAnnotationBundle\Attribute\SerializerDescribe;

class EntityParent {   
	private $proprtyA;
}

#[SerializerDescribe([
	'propertyA' => [
		'groups' => [
 			'group_1', 'group_2'
 		]
	],
	'propertyB' => [
 		'serializedName' => 'new_name',
 		'maxDepth' => 2
 	]
])]
class EntityChild extends EntityParent {
    private $propretyB;
}
use GollumSF\SerializerDescribeAnnotationBundle\Annotation\SerializerDescribe;

class EntityParent {   
	private $propertyA;
}

/**
 * @SerializerDescribe({
 * 	"propertyA" = {
 *		"groups" = {
 * 			"group_1", "group_2"
 * 		}
 *	},
 * 	"propertyB" = {
 *		"serializedName" = "new_name",
 *		"maxDepth" = 2
 *	}
 * })
 */
class EntityChild extends EntityParent {
	private $propertyB;
}