/** * @return Cache */ public function getCache() { $key = 'pckg.database.repository.cache.' . sha1(Cache::getCachePathByRepository($this)); $context = context(); if (!$context->exists($key)) { $context->bind($key, $cache = new Cache($this)); } return $context->get($key); }
protected function buildOldKeySql(Cache $cache, Table $table, Constraint $key) { $cachedConstraint = $cache->getConstraint($key->getName(), $table->getName()); $type = $cachedConstraint['type'] == 'PRIMARY KEY' ? 'PRIMARY' : $cachedConstraint['type'] . ' KEY'; return $type . ' ' . $key->getName(); }