Symfony jms serializer enable when needed

Clash Royale CLAN TAG#URR8PPPSymfony jms serializer enable when needed
I have jms serializer and in my class entity have annotation. I have case when I need apply jms serializer annotation only in some case. How to do this ? First I think need move annotation from entity class to uml maybe and create some handler where I can enable this annotation for this entity, in the rest of the time jms are not applicable to entity
my entity
/**
* @AnnotationExclusionPolicy("all")
*/
class Application implements ContainsRecordedMessages
{
/**
* @var int
*
* @AnnotationGroups({
* "get_application"
* })
* @AnnotationExpose()
*/
private $id;
/**
* @var int
*
* @AnnotationGroups({
* "post_application"
* })
* @AnnotationSerializedName("company_id")
* @AnnotationExpose()
*/
private $companyId;
/**
* @var string
*
* @AnnotationGroups({
* "post_application"
* })
* @AnnotationSerializedName("channel_sale")
* @AnnotationExpose()
*/
private $channelSale;
and I have class manager for this entity where I want enable jms and the disable jms serializer annotation
class ApplicationManager
{
public function someFunction()
{
$this->enableJmsForEntity(Application::class);
//some logic
//
$this->disableJmsForEntity(Application::class);
}
}
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.