PHP code example of gollumsf / serializer-describe-annotation-bundle

1. Go to this page and download the library: Download gollumsf/serializer-describe-annotation-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gollumsf / serializer-describe-annotation-bundle example snippets


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

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