store() public method

Store a Document in the repository.
public store ( JamesMoss\Flywheel\DocumentInterface $document ) : boolean
$document JamesMoss\Flywheel\DocumentInterface The document to store
return boolean True if stored, otherwise false
Exemplo n.º 1
0
 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'));
 }
 /**
  * @param EncryptedTransaction $encryptedTransaction
  * @throws \Exception
  */
 public function insert(EncryptedTransaction $encryptedTransaction)
 {
     $transactionDocument = $this->encryptedTransactionToDocument($encryptedTransaction);
     $this->repository->store($transactionDocument);
 }
 /**
  * @param EncryptedWallet $encryptedWallet
  */
 public function insert(EncryptedWallet $encryptedWallet)
 {
     $walletDocument = $this->walletToDocument($encryptedWallet);
     $this->repository->store($walletDocument);
 }
 /**
  * @param EncryptedAddress $encryptedAddress
  * @throws \Exception
  */
 public function insert(EncryptedAddress $encryptedAddress)
 {
     $addressDocument = $this->encryptedAddressToDocument($encryptedAddress);
     $this->repository->store($addressDocument);
 }