Commit 3578524da3cb34ba173eae585f2358881661b050

Authored by Neil Blakey-Milner
1 parent 2a111463

Add some debugging log helpers


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3798 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/metadata/valueinstance.inc.php
... ... @@ -93,6 +93,8 @@ class KTValueInstance extends KTEntity {
93 93 function &getByLookupAndParentBehaviour($oLookup, $oBehaviour, $aOptions = null) {
94 94 $iLookupId = KTUtil::getId($oLookup);
95 95 $iBehaviourId = KTUtil::getId($oBehaviour);
  96 + $GLOBALS['default']->log->debug('KTValueInstance::getByLookupAndParentBehaviour: lookup id is ' . print_r($iLookupId, true));
  97 + $GLOBALS['default']->log->debug('KTValueInstance::getByLookupAndParentBehaviour: behaviour id is ' . $iBehaviourId);
96 98 $sInstanceTable = KTUtil::getTableName('field_value_instances');
97 99 $sBehaviourOptionsTable = KTUtil::getTableName('field_behaviour_options');
98 100 $aQuery = array(
... ... @@ -102,6 +104,11 @@ class KTValueInstance extends KTEntity {
102 104 array($iBehaviourId, $iLookupId),
103 105 );
104 106 $iId = DBUtil::getOneResultKey($aQuery, 'instance_id');
  107 + if (PEAR::isError($iId)) {
  108 + $GLOBALS['default']->log->error('KTValueInstance::getByLookupAndParentBehaviour: error from db is: ' . print_r($iId, true));
  109 + return $iId;
  110 + }
  111 + $GLOBALS['default']->log->debug('KTValueInstance::getByLookupAndParentBehaviour: id of instance is ' . $iId);
105 112 if (KTUtil::arrayGet($aOptions, 'ids')) {
106 113 return $iId;
107 114 }
... ...