3

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.

Govinda raj
  • 613
  • 3
  • 16
  • 31

2 Answers2

3

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

rafrsr
  • 1,940
  • 3
  • 15
  • 31
1

It allows to serialize just selected group of attributes (eg. to skip internal ones).

Read more here: http://symfony.com/blog/new-in-symfony-2-7-serialization-groups

Diabl0
  • 146
  • 7