Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Minor changes
  • Loading branch information
dunglas committed Jan 18, 2016
commit 23f3ac6b15fca8ca52607ab71768b6028c7f2b3d
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata)

if (isset($yaml['attributes']) && is_array($yaml['attributes'])) {
$attributesMetadata = $classMetadata->getAttributesMetadata();

foreach ($yaml['attributes'] as $attribute => $data) {
if (isset($attributesMetadata[$attribute])) {
$attributeMetadata = $attributesMetadata[$attribute];
Expand All @@ -76,12 +75,16 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata)

if (isset($data['groups'])) {
foreach ($data['groups'] as $group) {
$attributeMetadata->addGroup((string) $group);
$attributeMetadata->addGroup($group);
}
}

if (isset($data['max_depth'])) {
$attributeMetadata->setMaxDepth((int) $data['max_depth']);
if (!is_int($data['max_depth'])) {
throw new MappingException('The "max_depth" value must an integer.');
}

$attributeMetadata->setMaxDepth($data['max_depth']);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@
<xsd:element name="group" type="xsd:string" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
<xsd:attribute name="max-depth" type="xsd:int" />
<xsd:attribute name="max-depth">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="0" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>

</xsd:schema>