/** * gets the previous change if the action is 'modified' * * @return ConceptPropertyHistory object */ function getPrevious() { $propertyId = $this->getConceptPropertyId(); $timestamp = $this->getCreatedAt(); //build the query string $c = new Criteria(); $crit0 = $c->getNewCriterion(ConceptPropertyHistoryPeer::CONCEPT_PROPERTY_ID, $propertyId); $crit1 = $c->getNewCriterion(ConceptPropertyHistoryPeer::CREATED_AT, $timestamp, Criteria::LESS_THAN); // Perform AND at level 0 ($crit0 $crit1 ) $crit0->addAnd($crit1); $c->add($crit0); //set order and limits $c->setLimit(1); $c->addDescendingOrderByColumn(ConceptPropertyHistoryPeer::CREATED_AT); $result = ConceptPropertyHistoryPeer::doSelect($c); //return the resulting object if (count($result)) { $result = $result[0]; } return $result; }
/** * Gets the date of the last update of a domain or uri * * @return integer (unless a format string is supplied) */ public function executeLastupdate() { $domain = $this->getRequestParameter('domain'); $objects = $this->getRequestParameter('objects'); $type = $this->getRequestParameter('type', "json"); $lastUpdate = ""; if (isset($domain)) { if ('schemas' == $objects) { $lastUpdate = SchemaPropertyElementHistoryPeer::getLastUpdateForDomain($domain, null); } if ('vocabs' == $objects) { $lastUpdate = ConceptPropertyHistoryPeer::getLastUpdateForDomain($domain, null); } } switch ($type) { case "json": echo json_encode($lastUpdate); break; default: } return sfView::NONE; }
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this SkosProperty is new, it will return * an empty collection; or if this SkosProperty has previously * been saved, it will retrieve related ConceptPropertyHistorys from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in SkosProperty. */ public function getConceptPropertyHistorysJoinFileImportHistory($criteria = null, $con = null) { // include the Peer class include_once 'lib/model/om/BaseConceptPropertyHistoryPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collConceptPropertyHistorys === null) { if ($this->isNew()) { $this->collConceptPropertyHistorys = array(); } else { $criteria->add(ConceptPropertyHistoryPeer::SKOS_PROPERTY_ID, $this->getId()); $this->collConceptPropertyHistorys = ConceptPropertyHistoryPeer::doSelectJoinFileImportHistory($criteria, $con); } } else { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(ConceptPropertyHistoryPeer::SKOS_PROPERTY_ID, $this->getId()); if (!isset($this->lastConceptPropertyHistoryCriteria) || !$this->lastConceptPropertyHistoryCriteria->equals($criteria)) { $this->collConceptPropertyHistorys = ConceptPropertyHistoryPeer::doSelectJoinFileImportHistory($criteria, $con); } } $this->lastConceptPropertyHistoryCriteria = $criteria; return $this->collConceptPropertyHistorys; }
if ($concept) { $vocabulary = $concept->getVocabulary(); } } $objectId = $concept_property->getId(); break; case 'historydetail': $showBc = true; $showVocabularyBc = true; $showConceptBc = true; $showconceptpropBc = true; $showHistoryBc = true; if (!isset($history)) { $id = $sf_params->get('id'); if ($id) { $history = ConceptPropertyHistoryPeer::retrieveByPK($id); } } if (!isset($concept_property)) { if ($history) { sfPropelParanoidBehavior::disable(); $concept_property = $history->getConceptProperty(); } } if (!isset($concept)) { if ($concept_property) { sfPropelParanoidBehavior::disable(); $concept = $concept_property->getConceptRelatedByConceptId(); } } if (!isset($vocabulary)) {
/** * * gets the last update, either of the vocabulary or the history * * @return integer */ public static function getLastUpdateDate($id) { $vocab = self::retrieveByPK($id); if ($vocab) { $lastVocabUpdate = $vocab->getLastUpdated(null); } $lastHistoryUpdate = ConceptPropertyHistoryPeer::getLastUpdateForVocab($id, null); $result = max(array($lastHistoryUpdate, $lastVocabUpdate)); return $result; }
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ConceptPropertyHistoryPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setCreatedAt($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setAction($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setConceptPropertyId($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setConceptId($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setVocabularyId($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setSkosPropertyId($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setObject($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setSchemeId($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setRelatedConceptId($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setLanguage($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setStatusId($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setCreatedUserId($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setChangeNote($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { $this->setImportId($arr[$keys[14]]); } }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param Connection $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(ConceptPropertyHistoryPeer::ID, $pks, Criteria::IN); $objs = ConceptPropertyHistoryPeer::doSelect($criteria, $con); } return $objs; }
/** * returns the last property history older than the supplied timestamp * * @return ConceptPropertyHistory * @param date $ts (optional) If null returns the latest */ public function getLastHistoryByTimestamp($ts = null) { $c = new Criteria(); $c->add(ConceptPropertyHistoryPeer::CONCEPT_PROPERTY_ID, $this->getId()); if ($ts) { $c->add(ConceptPropertyHistoryPeer::CREATED_AT, $ts, Criteria::LESS_EQUAL); } $c->addDescendingOrderByColumn(ConceptPropertyHistoryPeer::CREATED_AT); $c->setLimit(1); $result = ConceptPropertyHistoryPeer::doSelect($c); $result = count($result) == 1 ? $result[0] : false; return $result; }