protected function populateMetadata(ClassMetadata $metadata)
{
$associations = array();
$fields = array();
$foundIdentifier = false;
foreach ($metadata->getReflectionClass()->getProperties() as $refProperty) {
$annotation = $this->getPropertyAnnotation($refProperty);
if ($annotation) {
if ('@rid' === $annotation->name) {
$foundIdentifier = true;
$metadata->setIdentifier($refProperty->getName());
$fields[$refProperty->getName()] = $annotation;
} elseif (in_array($annotation->type, $this->getAssociationTypes())) {
$associations[$refProperty->getName()] = $annotation;
} else {
$fields[$refProperty->getName()] = $annotation;
}
}
}
if (!$foundIdentifier) {
throw MappingException::missingRid($metadata->getName());
}
$metadata->setFields($fields);
$metadata->setAssociations($associations);
return $associations;
}