private function getCascadeMode(SimpleXMLElement $cascadeElement)
{
$cascade = 0;
foreach ($cascadeElement->children() as $action) {
// According to the JPA specifications, XML uses "cascade-persist"
// instead of "persist". Here, both variations
// are supported because both YAML and Annotation use "persist"
// and we want to make sure that this driver doesn't need to know
// anything about the supported cascading actions
$cascadeMode = str_replace('cascade-', '', $action->getName());
$constantName = 'Doctrine\\ODM\\PHPCR\\Mapping\\ClassMetadata::CASCADE_' . strtoupper($cascadeMode);
if (!defined($constantName)) {
throw new MappingException("Cascade mode '{$cascadeMode}' not supported.");
}
$cascade |= constant($constantName);
}
return $cascade;
}