/** * Creates a diff from a set of triples to a set of troples * * * @param Traversable $from * @param Traversable $to */ public static function create(Traversable $from, Traversable $to) { $diff = new self(); foreach ($to as $triple) { $diff->add($triple); } foreach ($from as $triple) { $diff->remove($triple); } return $diff; }
public static function byKey($_key, $_noRemove = false) { $values = array('key' => $_key); $sql = 'SELECT ' . DB::buildField(__CLASS__) . ' FROM cache WHERE `key`=:key'; $cache = DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW, PDO::FETCH_CLASS, __CLASS__); if (!is_object($cache)) { $cache = new self(); $cache->setKey($_key); $cache->setDatetime(date('Y-m-d H:i:s')); $cache->_hasExpired = true; } else { if (!$_noRemove && $cache->hasExpired()) { $cache->remove(); } } return $cache; }
public static function removeIfExists($proUid) { $process = \ProcessPeer::retrieveByPK($proUid); if ($process) { $me = new self(); $me->proUid = $process->getProUid(); $me->remove(); } }
public static function removeIfExists($prjUid) { $project = ProjectPeer::retrieveByPK($prjUid); if ($project) { $me = new self(); $me->prjUid = $project->getPrjUid(); $me->project = $project; $me->remove(); } }