From 45ec58fc7ece2a314f250d377eec81d86c181cdb Mon Sep 17 00:00:00 2001 From: Christian Heinrich Date: Thu, 20 May 2010 23:50:59 +0200 Subject: [PATCH] Updated message and added behaviour for public static vars Signed-off-by: David Abdemoulaie --- lib/Doctrine/ORM/Tools/SchemaValidator.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/SchemaValidator.php b/lib/Doctrine/ORM/Tools/SchemaValidator.php index 802f30fe5..5fbe6fc72 100644 --- a/lib/Doctrine/ORM/Tools/SchemaValidator.php +++ b/lib/Doctrine/ORM/Tools/SchemaValidator.php @@ -175,9 +175,10 @@ class SchemaValidator } 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" - ." 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" - ." recommends using protected / private properties on entities only. See the manual for more detailed information."; + if ($publicAttr->isStatic()) { + continue; + } + $ce[] = "Field '".$publicAttr->getName()."' in class '".$class->name."' must be private or protected. Public fields break lazy-loading."; } if ($ce) {