Abstraction for Key-Value to Plain Old PHP Object mapping
Abstraction for Key-Value to Plain Old PHP Object mapping
The Persistence interfaces are rather overkill for many implementations in the NoSQL world that are only key-value stores with some additional features on top. Doctrine Key Value Store to the rescue. This project offers a much simpler lightweight API that is centered on a key-value API to fetch/save objects.
Following vendors are targeted:
We happily accept contributions for any of the drivers.
Suppose we track e-mail campaigns based on campaign id and recipients.
campaign = $campaign;
$this->recipient = $recipient;
$this->status = $status;
}
}persist($response);
//.... persists as much as you can :-)
$entityManager->flush();find("Response",array("campaign" => "1234","recipient" => "[email protected]"));same as create, just reuse the same id.
find("Response",array("1234","[email protected]"));
$entityManager->remove($response);
$entityManager->flush();There is no factory yet that simplifies the creation process, here is the full code necessary to instantiate a KeyValue EntityManager with a Doctrine Cache backend:
setMappingDriverImpl($metadata);
$config->setMetadataCache($cache);
$entityManager = new EntityManager($storage, $config);If you want to use WindowsAzure Table you can use the following configuration to instantiate the storage:
use Doctrine\KeyValueStore\Storage\AzureSdkTableStorage;
use WindowsAzure\Common\ServicesBuilder;
$connectionString = ""; // Windows Azure Connection string
$builder = ServicesBuilder::getInstance();
$client = $builder->createTableService($connectionString);
$storage = new AzureSdkTableStorage($client);If you want to use Doctrine DBAL as backend:
$params = array();
$tableName = "storage";
$idColumnName = "id";
$dataColumnName = "serialized_data";
$conn = DriverManager::getConnection($params);
$storage = new DBALStorage($conn, $tableName, $idColumnName, $dataColumnName);No open issues yet, or sync has not completed.