Exemplo n.º 1
0
 /**
  * Get disabled consent from database
  *
  * @return bool True on success and false on error
  */
 private function _loadDisableConsent()
 {
     $eid = $this->_entity->getEid();
     $revisionId = $this->_entity->getRevisionid();
     $cacheProvider = sspmod_janus_DiContainer::getInstance()->getCacheProvider();
     // Try to get result from cache
     $cacheKey = 'entity-disableconsent-' . $eid . '-' . $revisionId;
     $cachedResult = $cacheProvider->fetch($cacheKey);
     if ($cachedResult !== false) {
         $this->_disableConsent = $cachedResult;
         return true;
     }
     $st = $this->execute('SELECT DC.*,
                 CONNECTION.name AS remoteentityid
         FROM ' . $this->getTablePrefix() . 'disableConsent AS DC
         INNER JOIN  ' . $this->getTablePrefix() . 'connection AS CONNECTION
             ON CONNECTION.id = DC.remoteeid
         WHERE DC.`connectionRevisionId` = ?;', array($this->_entity->getId()));
     if ($st === false) {
         return false;
     }
     $row = $st->fetchAll(PDO::FETCH_ASSOC);
     $this->_disableConsent = array();
     foreach ($row as $data) {
         $this->_disableConsent[$data['remoteentityid']] = $data;
     }
     // Store disable consent in cache, note that this does not have to be flushed since a new revision
     // will trigger a new version of the cache anyway
     $cacheProvider->save($cacheKey, $this->_disableConsent);
     return true;
 }
 /**
  * Get disabled consent from database
  *
  * @return bool True on success and false on error
  */
 private function _loadDisableConsent()
 {
     $st = $this->execute('SELECT * 
         FROM ' . self::$prefix . 'disableConsent 
         WHERE `eid` = ? AND `revisionid` = ?;', array($this->_entity->getEid(), $this->_entity->getRevisionid()));
     if ($st === false) {
         return false;
     }
     $row = $st->fetchAll(PDO::FETCH_ASSOC);
     $this->_disableConsent = array();
     foreach ($row as $data) {
         $this->_disableConsent[$data['remoteentityid']] = $data;
     }
     return true;
 }