Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whats is the use of annotation group in doctrine

I am new to doctrine, In my symfony project all the entity annotation linked with groups but I am not getting what is the use of Groups.

/**
     * @ORM\Column(type="string", length=64)
     * @Groups({"public","details"})
     */

I have newly added the field in my entity file, while executing the schema update getting (newly added field) was never imported.

What is groups and how it's useful.

like image 521
Govinda raj Avatar asked Sep 06 '25 02:09

Govinda raj


1 Answers

Groups is not part of doctrine, and is not necessary unless you need serialize objects to use json or xml (Rest API, etc)

http://symfony.com/doc/current/components/serializer.html#attributes-groups http://symfony.com/blog/new-in-symfony-2-7-serialization-groups

like image 163
rafrsr Avatar answered Sep 08 '25 15:09

rafrsr