Neos\Flow\Persistence\Doctrine\Service::validateMapping PHP Метод

validateMapping() публичный Метод

Validates the metadata mapping for Doctrine, using the SchemaValidator of Doctrine.
public validateMapping ( ) : array
Результат array
    public function validateMapping()
    {
        try {
            $validator = new SchemaValidator($this->entityManager);
            return $validator->validateMapping();
        } catch (\Exception $exception) {
            return [[$exception->getMessage()]];
        }
    }

Usage Example

Пример #1
0
 /**
  * Validate the class/table mappings
  *
  * Checks if the current class model schema is valid. Any inconsistencies
  * in the relations between models (for example caused by wrong or
  * missing annotations) will be reported.
  *
  * Note that this does not check the table structure in the database in
  * any way.
  *
  * @return void
  * @see neos.flow:doctrine:entitystatus
  */
 public function validateCommand()
 {
     $this->outputLine();
     $classesAndErrors = $this->doctrineService->validateMapping();
     if (count($classesAndErrors) === 0) {
         $this->outputLine('Mapping validation passed, no errors were found.');
     } else {
         $this->outputLine('Mapping validation FAILED!');
         foreach ($classesAndErrors as $className => $errors) {
             $this->outputLine('  %s', [$className]);
             foreach ($errors as $errorMessage) {
                 $this->outputLine('    %s', [$errorMessage]);
             }
         }
         $this->quit(1);
     }
 }