<?php
use Doctrine\ORM\Tools\SchemaValidator;
use Doctrine\ORM\Mapping as A;
/**
* @A\Entity
* @A\Table(name="foo")
*/
class Foo
{
/**
* @A\Column(type="integer", name="id")
* @A\Id
* @A\GeneratedValue(strategy="AUTO")
*/
public $id;
/**
* @A\Column(type="strig", name="name")
*/
public $name;
/**
* @A\ManyToOne(targetEntity="Foo", inversedBy="idk")
*/
public $parent;
}
$metadata = $entityManager->getMetadataFactory()
->getMetadataFor(Foo::class);
$validator = new SchemaValidator($entityManager);
dump($validator->validateClass($metadata));
array:2 [
0 => "The field 'Foo#name' uses a non-existent type 'strig'."
1 => "The association Foo#parent refers to the inverse side field Foo#idk which does not exist."
]