Doctrine\ODM\PHPCR\Mapping\ClassMetadata::validateTranslatables PHP Method

validateTranslatables() public method

Validate translatable fields - ensure that the document has a translator strategy in place.
    public function validateTranslatables()
    {
        if (count($this->translatableFields) > 0) {
            if (null === $this->translator) {
                throw MappingException::noTranslatorStrategy($this->name, $this->translatableFields);
            }
        }
    }

Usage Example

 /**
  * Validate runtime metadata is correctly defined.
  *
  * @param ClassMetadata $class
  * @param $parent
  * @throws MappingException
  */
 protected function validateRuntimeMetadata($class, $parent)
 {
     if (!$class->reflClass) {
         // only validate if there is a reflection class instance
         return;
     }
     $class->validateIdentifier();
     $class->validateReferences();
     $class->validateLifecycleCallbacks($this->getReflectionService());
     $class->validateTranslatables();
     // verify inheritance
     // TODO
 }
ClassMetadata