Remove incorrect (outdated) validation for public fields in SchemaValidator
This commit is contained in:
parent
626efdafd4
commit
1f3290faae
@ -236,20 +236,6 @@ class SchemaValidator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($class->reflClass->getProperties(\ReflectionProperty::IS_PUBLIC) as $publicAttr) {
|
|
||||||
if ($publicAttr->isStatic()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! isset($class->fieldMappings[$publicAttr->getName()]) &&
|
|
||||||
! isset($class->associationMappings[$publicAttr->getName()])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ce[] = "Field '".$publicAttr->getName()."' in class '".$class->name."' must be private ".
|
|
||||||
"or protected. Public fields may break lazy-loading.";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($class->subClasses as $subClass) {
|
foreach ($class->subClasses as $subClass) {
|
||||||
if (!in_array($class->name, class_parents($subClass))) {
|
if (!in_array($class->name, class_parents($subClass))) {
|
||||||
$ce[] = "According to the discriminator map class '" . $subClass . "' has to be a child ".
|
$ce[] = "According to the discriminator map class '" . $subClass . "' has to be a child ".
|
||||||
|
@ -38,12 +38,6 @@ class SchemaValidatorTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
foreach ($classes as $class) {
|
foreach ($classes as $class) {
|
||||||
$ce = $validator->validateClass($class);
|
$ce = $validator->validateClass($class);
|
||||||
|
|
||||||
foreach ($ce as $key => $error) {
|
|
||||||
if (strpos($error, "must be private or protected. Public fields may break lazy-loading.") !== false) {
|
|
||||||
unset($ce[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->assertEquals(0, count($ce), "Invalid Modelset: " . $modelSet . " class " . $class->name . ": ". implode("\n", $ce));
|
$this->assertEquals(0, count($ce), "Invalid Modelset: " . $modelSet . " class " . $class->name . ": ". implode("\n", $ce));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user