gollumsf / serializer-describe-annotation-bundle
Add class annotation for describe serializer property
Installs: 666
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.2
- doctrine/annotations: ^1|^2
- symfony/framework-bundle: ^4.4|^5|^6
- symfony/serializer-pack: ^1
Requires (Dev)
- gollumsf/reflection-property-test: ^1.0
- nyholm/symfony-bundle-test: 1.8.1
- phpunit/phpunit: ^9.3
README
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; }