/** * @param ReflectionClass $reflClass * @param Metadata $metadata * * @return string|int */ protected function getIdForClass($object, Metadata $metadata) { $getter = 'get' . ucfirst(strtolower($metadata->getId())); if (!method_exists($object, $getter)) { throw new \RuntimeException(sprintf('The class "%s" must have a "%s" method for accessing the property mapped as the id field (%s)', get_class($object), $getter, $metadata->getId())); } return $object->{$getter}(); }
/** * @param Metadata $metadata * @return array */ protected function validateMetadata(Metadata $metadata) { $errors = array(); if (null == $metadata->getId()) { $errors[] = 'Id cannot be null.'; } if (null == $metadata->getPrefix()) { $errors[] = 'Prefix cannot be null.'; } return $errors; }