Skip to content

GollumSF/serializer-describe-annotation-bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GollumSFSerializerDescribeAnnotationBundle

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;
}