This can only be called once. To connect to another workspace or with
another credential, use a fresh instance of transport.
What implementation of credentials is supported is transport specific.
public login ( PHPCR\CredentialsInterface $credentials = null, string $workspaceName = null ) : string | ||
$credentials | PHPCR\CredentialsInterface | the credentials to connect with the backend |
$workspaceName | string | The workspace name to connect to. Null means to connect to the default workspace. |
return | string | The workspace name that we connected to. This must be $workspaceName unless that was null, where it is the name of the default workspace. |
/** * {@inheritDoc} * * @api */ public function login(CredentialsInterface $credentials = null, $workspaceName = null) { if (!($workspaceName = $this->transport->login($credentials, $workspaceName))) { throw new RepositoryException('transport failed to login without telling why'); } /** @var $session Session */ $session = $this->factory->get('Session', array($this, $workspaceName, $credentials, $this->transport)); $session->setSessionOption(Session::OPTION_AUTO_LASTMODIFIED, $this->options[Session::OPTION_AUTO_LASTMODIFIED]); if ($this->options['transactions']) { $utx = $this->factory->get('Transaction\\UserTransaction', array($this->transport, $session, $session->getObjectManager())); $session->getWorkspace()->setTransactionManager($utx); } return $session; }
/** * {@inheritDoc} * * @api */ public function login(CredentialsInterface $credentials = null, $workspaceName = null) { if ($workspaceName == null) { //TODO: can default workspace have other name? $workspaceName = 'default'; } if (!$this->transport->login($credentials, $workspaceName)) { throw new RepositoryException('transport failed to login without telling why'); } $session = $this->factory->get('Session', array($this, $workspaceName, $credentials, $this->transport)); if ($this->options['transactions']) { $utx = $this->factory->get('Transaction\\UserTransaction', array($this->transport, $session, $session->getObjectManager())); $session->getWorkspace()->setTransactionManager($utx); } return $session; }
/** * {@inheritDoc} */ public function login(CredentialsInterface $credentials = null, $workspaceName = null) { return $this->transport->login($credentials, $workspaceName); }