public function testSaveWithoutFlush()
 {
     $statement = StatementFixtures::getMinimalStatement();
     $self = $this;
     $this->mappedStatementRepository->expects($this->once())->method('storeMappedStatement')->with($this->callback(function (MappedStatement $mappedStatement) use($self, $statement) {
         return $self->assertMappedStatement(MappedStatement::createFromModel($statement), $mappedStatement);
     }), false);
     $this->statementRepository->storeStatement($statement, false);
 }
 public function testCallToFlushCanBeSuppressed()
 {
     $this->objectManager->expects($this->never())->method('flush');
     $mappedStatement = MappedStatement::createFromModel(StatementFixtures::getMinimalStatement());
     $this->repository->storeMappedStatement($mappedStatement, false);
 }
 /**
  * Writes a {@link Statement} to the underlying data storage.
  *
  * @param Statement $statement The statement to store
  * @param bool      $flush     Whether or not to flush the managed objects
  *                             immediately (i.e. write them to the data
  *                             storage)
  *
  * @return string The UUID of the created Statement
  */
 public final function storeStatement(Statement $statement, $flush = true)
 {
     $uuid = $statement->getId();
     $mappedStatement = MappedStatement::createFromModel($statement);
     $mappedStatement->stored = new \DateTime();
     if (null === $uuid) {
         $uuid = Uuid::uuid4()->toString();
         $mappedStatement->id = $uuid;
     }
     $this->storeMappedStatement($mappedStatement, $flush);
     return $uuid;
 }