Skip to content

Commit

Permalink
Merge pull request jackalope#22 from starkj/move_get_transaction_manager
Browse files Browse the repository at this point in the history
getTransactionManager() moved to Workspace
  • Loading branch information
dbu committed Jul 26, 2011
2 parents 7a3b3aa + d6545d5 commit c237d70
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion api-test/suite
2 changes: 1 addition & 1 deletion lib/phpcr
2 changes: 1 addition & 1 deletion src/Jackalope/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function login(CredentialsInterface $credentials = null, $workspaceName =
$session = $this->factory->get('Session', array($this, $workspaceName, $credentials, $this->transport));
if ($this->transactions) {
$utx = $this->factory->get('Transaction\\UserTransaction', array($this->transport, $session));
$session->setTransactionManager($utx);
$session->getWorkspace()->setTransactionManager($utx);
}

return $session;
Expand Down
11 changes: 1 addition & 10 deletions src/Jackalope/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,12 @@ public function __construct($factory, Repository $repository, $workspaceName, \P
$this->repository = $repository;
$this->objectManager = $this->factory->get('ObjectManager', array($transport, $this));
$this->workspace = $this->factory->get('Workspace', array($this, $this->objectManager, $workspaceName));
$this->utx = $this->workspace->getTransactionManager();
$this->credentials = $credentials;
$this->namespaceRegistry = $this->workspace->getNamespaceRegistry();
self::registerSession($this);
}

public function setTransactionManager(\PHPCR\Transaction\UserTransactionInterface $utx)
{
$this->utx = $utx;
}

public function getTransactionManager()
{
return $this->utx;
}

/**
* Returns the Repository object through which this session was acquired.
*
Expand Down
23 changes: 23 additions & 0 deletions src/Jackalope/Workspace.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Workspace implements \PHPCR\WorkspaceInterface

protected $session;
protected $nodeTypeManager;
protected $utx = null;
protected $name;
protected $namespaceRegistry;

Expand Down Expand Up @@ -225,6 +226,28 @@ public function getQueryManager()
return $this->factory->get('Query\QueryManager', array($this->session->getObjectManager()));
}

/**
* Sets the TransactionManager
*
* @param \PHPCR\Transaction\UserTransactionInterface $utx A UserTransaction object
*/
public function setTransactionManager(\PHPCR\Transaction\UserTransactionInterface $utx)
{
$this->utx = $utx;
}

/**
* Returns the TransactionManager object
*
* @return \PHPCR\Transaction\UserTransactionInterface A UserTransaction object
* @api
*/
public function getTransactionManager()
{
return $this->utx;
}


/**
* Returns the NamespaceRegistry object, which is used to access the mapping
* between prefixes and namespaces.
Expand Down

0 comments on commit c237d70

Please sign in to comment.