Updated message and added behaviour for public static vars
Signed-off-by: David Abdemoulaie <dave@hobodave.com>
This commit is contained in:
parent
773f56bef2
commit
45ec58fc7e
@ -175,9 +175,10 @@ class SchemaValidator
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($class->reflClass->getProperties(\ReflectionProperty::IS_PUBLIC) as $publicAttr) {
|
foreach ($class->reflClass->getProperties(\ReflectionProperty::IS_PUBLIC) as $publicAttr) {
|
||||||
$ce[] = "Attribute '".$publicAttr->getName()."' in class '".$class->name."' is marked as public. Make sure you initialize your entities manually"
|
if ($publicAttr->isStatic()) {
|
||||||
." before accessing these properties or you will experience strange behaviour as using public properties will disallow Doctrine to use lazy loading. The Doctrine Team strongly"
|
continue;
|
||||||
." recommends using protected / private properties on entities only. See the manual for more detailed information.";
|
}
|
||||||
|
$ce[] = "Field '".$publicAttr->getName()."' in class '".$class->name."' must be private or protected. Public fields break lazy-loading.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ce) {
|
if ($ce) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user