Exemplo n.º 1
0
	protected function saveAttribute($f, $value = false) {
		// We check a cID/cvID/akID combo, and if that particular combination has an attribute value ID that
		// is NOT in use anywhere else on the same cID, cvID, akID combo, we use it (so we reuse IDs)
		// otherwise generate new IDs
		$av = $f->getAttributeValueObject($this, true);
		parent::saveAttribute($av, $value);
		$db = Loader::db();
		$v = array($f->getFileID(), $f->getFileVersionID(), $this->getAttributeKeyID(), $av->getAttributeValueID());
		$db->Replace('FileAttributeValues', array(
			'fID' => $f->getFileID(), 
			'fvID' => $f->getFileVersionID(), 
			'akID' => $this->getAttributeKeyID(), 
			'avID' => $av->getAttributeValueID()
		), array('fID', 'fvID', 'akID'));
		$f->logVersionUpdate(FileVersion::UT_EXTENDED_ATTRIBUTE, $this->getAttributeKeyID());
		$fo = $f->getFile();
		$fo->refreshCache();
		$fo->reindex();
		$f->populateAttributes();
		unset($av);
		unset($fo);
		unset($f);
	}
Exemplo n.º 2
0
 protected function saveAttribute($nvc, $value = false)
 {
     // We check a cID/cvID/akID combo, and if that particular combination has an attribute value ID that
     // is NOT in use anywhere else on the same cID, cvID, akID combo, we use it (so we reuse IDs)
     // otherwise generate new IDs
     $av = $nvc->getAttributeValueObject($this, true);
     parent::saveAttribute($av, $value);
     $db = Loader::db();
     $v = array($nvc->getCollectionID(), $nvc->getVersionID(), $this->getAttributeKeyID(), $av->getAttributeValueID());
     $db->Replace('CollectionAttributeValues', array('cID' => $nvc->getCollectionID(), 'cvID' => $nvc->getVersionID(), 'akID' => $this->getAttributeKeyID(), 'avID' => $av->getAttributeValueID()), array('cID', 'cvID', 'akID'));
     unset($av);
 }