Module: appdb Branch: master Commit: 00f9a20596bf14a5b72b697016a999fbaced0318 URL: http://source.winehq.org/git/appdb.git/?a=commit;h=00f9a20596bf14a5b72b69701...
Author: Alexander Nicolaysen Sørnes alex@thehandofagony.com Date: Tue Jul 21 17:04:11 2009 +0200
objectManager: Show a note if a parent entry is missing
---
include/objectManager.php | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/include/objectManager.php b/include/objectManager.php index 5153941..d8ad2e2 100644 --- a/include/objectManager.php +++ b/include/objectManager.php @@ -1217,12 +1217,18 @@ class ObjectManager if($sLinkText == 'default') { $oParent = $oObject->objectGetParent(); - $oParentOM = new objectManager(get_class($oParent), '', $oParent->objectGetId()); - $sClassName = $oParentOM->getOptionalSetting('objectGetClassDisplayName', false); - if($sClassName) - $sLinkText = "Move to another $sClassName"; - else - $sLinkText = 'Move to another parent entry'; + if(!$oParent) + { + echo html_note('Failed to find parent entry', 'No parent entry could be found, even though it is supposed to exist.'); + } else + { + $oParentOM = new objectManager(get_class($oParent), '', $oParent->objectGetId()); + $sClassName = $oParentOM->getOptionalSetting('objectGetClassDisplayName', false); + if($sClassName) + $sLinkText = "Move to another $sClassName"; + else + $sLinkText = 'Move to another parent entry'; + } } echo "<a href="".$this->makeUrl("showChangeParent", $this->iId, "Move to another parent entry")."">$sLinkText</a>\n";