Store a Document in the repository, but only if it already
exists. The document must have an ID.
/** * @param EncryptedWallet $wallet * @throws \Exception */ public function update(EncryptedWallet $wallet) { $walletDocument = $this->walletToDocument($wallet); if (!$this->repository->update($walletDocument)) { // TODO: custom exception throw new \Exception("Error updating wallet repository"); } }
/** * @param EncryptedTransaction $encryptedTransaction * @throws \Exception */ public function update(EncryptedTransaction $encryptedTransaction) { // DEBUG //var_dump($encryptedTransaction); //die(); $encryptedTransactionDocument = $this->encryptedTransactionToDocument($encryptedTransaction); // DEBUG //var_dump($encryptedTransactionDocument); //die(); if (!$this->repository->update($encryptedTransactionDocument)) { // TODO: custom exception throw new \Exception("Error updating encrypted transaction repository"); } }
/** * @param EncryptedAddress $encryptedAddress * @throws \Exception */ public function update(EncryptedAddress $encryptedAddress) { // DEBUG //var_dump($encryptedAddress); //die(); $encryptedAddressDocument = $this->encryptedAddressToDocument($encryptedAddress); // DEBUG //var_dump($encryptedAddressDocument); //die(); if (!$this->repository->update($encryptedAddressDocument)) { // TODO: custom exception throw new \Exception("Error updating encrypted address repository"); } }
public function testChangingDocumentIDChangesFilename() { if (!is_dir('/tmp/flywheel')) { mkdir('/tmp/flywheel'); } $config = new Config('/tmp/flywheel'); $repo = new Repository('_pages', $config); $doc = new Document(array('test' => '123')); $doc->setId('test1234'); $repo->store($doc); $this->assertTrue(file_exists('/tmp/flywheel/_pages/test1234.json')); $doc->setId('9876test'); $repo->update($doc); $this->assertFalse(file_exists('/tmp/flywheel/_pages/test1234.json')); }