commit() 공개 메소드

Commits the UnitOfWork
public commit ( object | array | null $document = null )
$document object | array | null optionally limit to a specific document or an array of documents
예제 #1
0
 /**
  * {@inheritDoc}
  *
  * Flush all current changes, that is save them within the phpcr session
  * and commit that session to permanent storage.
  *
  * @param object|array|null $document optionally limit to a specific
  *      document or an array of documents
  *
  * @throws InvalidArgumentException if $document is neither null nor a
  *      document or an array of documents
  */
 public function flush($document = null)
 {
     if (null !== $document && !is_object($document) && !is_array($document)) {
         throw new InvalidArgumentException('Parameter $document needs to be an object, ' . gettype($document) . ' given');
     }
     $this->errorIfClosed();
     $this->unitOfWork->commit($document);
 }
예제 #2
0
 /**
  * Flush all current changes, that is save them within the phpcr session
  * and commit that session to permanent storage.
  *
  * @param object|array|null $document
  */
 public function flush($document = null)
 {
     if (null !== $document && !is_object($document) && !is_array($document)) {
         throw new \InvalidArgumentException(gettype($document));
     }
     $this->errorIfClosed();
     $this->unitOfWork->commit($document);
 }
예제 #3
0
 public function testSchedules()
 {
     $user1 = new CmsUser();
     $user1->username = '******';
     $address = new CmsAddress();
     $address->city = "Springfield";
     $address->zip = "12354";
     $address->country = "Germany";
     $user1->address = $address;
     // getScheduledInserts
     $this->uow->scheduleInsert($user1);
     $this->uow->computeChangeSets();
     $scheduledInserts = $this->uow->getScheduledInserts();
     $this->assertCount(2, $scheduledInserts);
     $this->assertEquals($user1, current($scheduledInserts));
     $this->assertEquals(32, strlen(key($scheduledInserts)), 'Size of key is 32 chars (oid)');
     $user1->username = '******';
     // getScheduledUpdates
     $this->uow->commit();
     $this->uow->scheduleInsert($user1);
     $this->uow->computeChangeSets();
     $scheduledUpdates = $this->uow->getScheduledUpdates();
     $this->assertCount(1, $scheduledUpdates);
     $this->assertEquals($user1, current($scheduledUpdates));
     $this->assertEquals(32, strlen(key($scheduledUpdates)), 'Size of key is 32 chars (oid)');
     // getScheduledRemovals
     $this->uow->scheduleRemove($user1);
     $scheduledRemovals = $this->uow->getScheduledRemovals();
     $this->assertCount(1, $scheduledRemovals);
     $this->assertEquals($user1, current($scheduledRemovals));
     $this->assertEquals(32, strlen(key($scheduledRemovals)), 'Size of key is 32 chars (oid)');
     // getScheduledMoves
     $this->uow->scheduleMove($user1, '/foobar');
     $scheduledMoves = $this->uow->getScheduledMoves();
     $this->assertCount(1, $scheduledMoves);
     $this->assertEquals(32, strlen(key($scheduledMoves)), 'Size of key is 32 chars (oid)');
     $this->assertEquals(array($user1, '/foobar'), current($scheduledMoves));
 }
예제 #4
0
 /**
  * Flush all current changes, that is save them within the phpcr session
  * and commit that session to permanent storage.
  *
  * @param object $document
  */
 public function flush($document = null)
 {
     $this->errorIfClosed();
     $this->unitOfWork->commit($document);
 }