4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Serializer\Mapping;
17 * @author Kévin Dunglas <dunglas@gmail.com>
19 class AttributeMetadata implements AttributeMetadataInterface
24 * @internal This property is public in order to reduce the size of the
25 * class' serialized representation. Do not access it. Use
26 * {@link getName()} instead.
33 * @internal This property is public in order to reduce the size of the
34 * class' serialized representation. Do not access it. Use
35 * {@link getGroups()} instead.
37 public $groups = array();
40 * Constructs a metadata for the given attribute.
44 public function __construct($name)
52 public function getName()
60 public function addGroup($group)
62 if (!in_array($group, $this->groups)) {
63 $this->groups[] = $group;
70 public function getGroups()
78 public function merge(AttributeMetadataInterface $attributeMetadata)
80 foreach ($attributeMetadata->getGroups() as $group) {
81 $this->addGroup($group);
86 * Returns the names of the properties that should be serialized.
90 public function __sleep()
92 return array('name', 'groups');