Browse Source

#1060 Internal: improved the symptoms when calling MetaModel::GetAttributeDef with an invalid attribute code (feedback on the class name and no more FATAL errors)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3492 a333f486-631f-4898-b8df-5754b55c2be0
romainq 10 years ago
parent
commit
f1ec5e3c09
1 changed files with 4 additions and 0 deletions
  1. 4 0
      core/metamodel.class.php

+ 4 - 0
core/metamodel.class.php

@@ -836,6 +836,10 @@ abstract class MetaModel
 	final static public function GetAttributeDef($sClass, $sAttCode)
 	{
 		self::_check_subclass($sClass);
+		if (!isset(self::$m_aAttribDefs[$sClass][$sAttCode]))
+		{
+			throw new Exception("Unknown attribute $sAttCode from class $sClass");
+		}
 		return self::$m_aAttribDefs[$sClass][$sAttCode];
 	}