Issue #1804024 by msonnabaum: Added Remove constructor from k/v interface.

8.0.x
Dries 2012-10-05 11:47:18 -04:00
parent 890865c7a4
commit a834496e18
4 changed files with 7 additions and 36 deletions

View File

@ -20,14 +20,12 @@ class DatabaseStorage extends StorageBase {
*
* @param string $collection
* The name of the collection holding key and value pairs.
* @param array $options
* An associative array of options for the key/value storage collection.
* Keys used:
* - table. The name of the SQL table to use, defaults to key_value.
* @param string $table
* The name of the SQL table to use, defaults to key_value.
*/
public function __construct($collection, array $options = array()) {
parent::__construct($collection, $options);
$this->table = isset($options['table']) ? $options['table'] : 'key_value';
public function __construct($collection, $table = 'key_value') {
parent::__construct($collection);
$this->table = $table;
}
/**

View File

@ -12,16 +12,6 @@ namespace Drupal\Core\KeyValueStore;
*/
interface KeyValueStoreInterface {
/**
* Constructs a new key/value collection.
*
* @param string $collection
* The name of the collection holding key and value pairs.
* @param array $options
* An associative array of options for the key/value storage collection.
*/
public function __construct($collection, array $options = array());
/**
* Returns the name of this collection.
*

View File

@ -9,11 +9,8 @@ namespace Drupal\Core\KeyValueStore;
/**
* Defines a default key/value store implementation.
*
* For performance reasons, this implementation is not based on
* Drupal\Core\KeyValueStore\StorageBase.
*/
class MemoryStorage implements KeyValueStoreInterface {
class MemoryStorage extends StorageBase {
/**
* The actual storage of key-value pairs.
@ -22,20 +19,6 @@ class MemoryStorage implements KeyValueStoreInterface {
*/
protected $data = array();
/**
* Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::__construct().
*/
public function __construct($collection, array $options = array()) {
$this->collection = $collection;
}
/**
* Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::getCollectionName().
*/
public function getCollectionName() {
return $this->collection;
}
/**
* Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::get().
*/

View File

@ -22,7 +22,7 @@ abstract class StorageBase implements KeyValueStoreInterface {
/**
* Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::__construct().
*/
public function __construct($collection, array $options = array()) {
public function __construct($collection) {
$this->collection = $collection;
}