Example #1
0
 /**
  * After previous migration execution hook.
  *
  * @return void
  */
 private function afterDown()
 {
     $query = new Query();
     $query->remove()->from('migrations')->where('version = ?', array($this->version))->run();
 }
Example #2
0
 /**
  * @covers Core\Modules\Cache\Adapters\Database::store
  */
 public function testStoringKeyValuePair()
 {
     $query = new Query();
     $query->remove()->from($this->tableName)->where("{$this->fields[0]} = ?", array(md5($this->key)))->run();
     $this->assertTrue($this->databaseCache->store($this->key, $this->value));
 }
Example #3
0
 /**
  * Removes the record from the database.
  *
  * @access private
  *
  * @return boolean
  */
 private function remove()
 {
     $query = new DB\Query();
     $this->query = $query->remove()->from(static::$tableName)->where(static::$primaryKeyField . ' = ?', array($this->{static::$primaryKeyField}));
     if (static::$isI18n) {
         $query_i18n = new DB\Query();
         $query_i18n = $query_i18n->remove()->from(static::$i18nTableName)->where(static::$i18nForeignKeyField . ' = ?', array($this->{static::$primaryKeyField}));
         return Core\DB()->run($this->query) && Core\DB()->run($query_i18n);
     }
     return Core\DB()->run($this->query);
 }
Example #4
0
 /**
  * Remove Ownership Data for an Owner.
  *
  * @param \Core\Base\Model|null $owner Owner instance
  *
  * @return void
  */
 public static function resetOwner(Base\Model $owner = null)
 {
     if (!$owner) {
         $owner = Core\Registry()->get('current_cms_user');
     }
     $query = new Core\Modules\DB\Query();
     Core\DB()->run($query->remove()->from('cms_ownership')->where('owner_id = ? AND model = ?', array($owner->getPrimaryKeyValue(), get_class($resource))));
 }