Inheritance: implements jackalope\FactoryInterface
 /**
  * Attempts to establish a connection to a repository using the given
  * parameters.
  *
  *
  *
  * @param  array|null                 $parameters string key/value pairs as repository arguments or null if a client wishes
  *                                                to connect to a default repository.
  * @return \PHPCR\RepositoryInterface a repository instance or null if this implementation does
  *                                               not understand the passed parameters
  * @throws \PHPCR\RepositoryException if no suitable repository is found or another error occurs.
  * @api
  */
 public function getRepository(array $parameters = null)
 {
     if (null == $parameters) {
         return null;
     }
     // check if we have all required keys
     $present = array_intersect_key(self::$required, $parameters);
     if (count(array_diff_key(self::$required, $present))) {
         return null;
     }
     $defined = array_intersect_key(array_merge(self::$required, self::$optional), $parameters);
     if (count(array_diff_key($defined, $parameters))) {
         return null;
     }
     if (isset($parameters['jackalope.factory'])) {
         $factory = is_object($parameters['jackalope.factory']) ? $parameters['jackalope.factory'] : new $parameters['jackalope.factory']();
     } else {
         $factory = new Factory();
     }
     $db = $parameters['jackalope.mongodb_database'];
     $transport = $factory->get('Transport\\MongoDB\\Client', array($db));
     $options['transactions'] = empty($parameters['jackalope.disable_transactions']);
     $options['stream_wrapper'] = empty($parameters['jackalope.disable_stream_wrapper']);
     return new Repository($factory, $transport, $options);
 }
 public function getRepository(array $parameters = null)
 {
     $factory = new Factory();
     $transport = $factory->get('Transport\\Fs\\Client', array($parameters));
     $options = array();
     return new Repository($factory, $transport, $options);
 }
 /**
  * Get a repository connected to the backend with the provided doctrine
  * dbal connection.
  *
  * {@inheritDoc}
  *
  * DoctrineDBAL repositories have no default repository, passing null as
  * parameters will always return null.
  *
  * @api
  */
 public function getRepository(array $parameters = null)
 {
     if (null === $parameters) {
         throw new ConfigurationException('Jackalope-doctrine-dbal needs parameters');
     }
     if (count(array_diff_key(self::$required, $parameters))) {
         throw new ConfigurationException('A required parameter is missing: ' . implode(', ', array_keys(array_diff_key(self::$required, $parameters))));
     }
     if (count(array_diff_key($parameters, self::$required, self::$optional))) {
         throw new ConfigurationException('Additional unknown parameters found: ' . implode(', ', array_keys(array_diff_key($parameters, self::$required, self::$optional))));
     }
     if (isset($parameters['jackalope.factory'])) {
         $factory = $parameters['jackalope.factory'] instanceof FactoryInterface ? $parameters['jackalope.factory'] : new $parameters['jackalope.factory']();
     } else {
         $factory = new Factory();
     }
     $dbConn = $parameters['jackalope.doctrine_dbal_connection'];
     $transport = isset($parameters['jackalope.data_caches']) ? $factory->get('Transport\\DoctrineDBAL\\CachedClient', array($dbConn, $parameters['jackalope.data_caches'])) : $factory->get('Transport\\DoctrineDBAL\\Client', array($dbConn));
     if (isset($parameters['jackalope.check_login_on_server'])) {
         $transport->setCheckLoginOnServer($parameters['jackalope.check_login_on_server']);
     }
     if (isset($parameters['jackalope.uuid_generator'])) {
         $transport->setUuidGenerator($parameters['jackalope.uuid_generator']);
     }
     if (isset($parameters['jackalope.logger'])) {
         $transport = $factory->get('Transport\\DoctrineDBAL\\LoggingClient', array($transport, $parameters['jackalope.logger']));
     }
     $options['transactions'] = empty($parameters['jackalope.disable_transactions']);
     $options['stream_wrapper'] = empty($parameters['jackalope.disable_stream_wrapper']);
     if (isset($parameters[Session::OPTION_AUTO_LASTMODIFIED])) {
         $options[Session::OPTION_AUTO_LASTMODIFIED] = $parameters[Session::OPTION_AUTO_LASTMODIFIED];
     }
     return new Repository($factory, $transport, $options);
 }
 public function getRepository(array $parameters = null)
 {
     if (!isset($parameters['path'])) {
         throw new \InvalidArgumentException('You must provide the "path" parameter for the filesystem jackalope repository');
     }
     $factory = new Factory();
     $transport = $factory->get('Transport\\Filesystem\\Client', array($parameters));
     $options = array();
     return new Repository($factory, $transport, $options);
 }
Beispiel #5
0
 /**
  * {@inheritDoc}
  */
 public function get($name, array $params = array())
 {
     switch ($name) {
         case 'Query\\QOM\\QueryObjectModelFactory':
             $name = 'Jackrabbit\\Query\\QOM\\QueryObjectModelFactory';
             break;
     }
     return parent::get($name, $params);
 }
 /**
  * {@inheritDoc}
  */
 public function get($name, array $params = array())
 {
     switch ($name) {
         case 'Query\\QOM\\QueryObjectModelFactory':
             $name = 'Jackrabbit\\Query\\QOM\\QueryObjectModelFactory';
             break;
         case 'PHPCR\\Util\\ValueConverter':
             return new ValueConverter();
     }
     return parent::get($name, $params);
 }
 /**
  * Get a repository connected to the Prismic backend specified in the
  * parameters.
  *
  * {@inheritDoc}
  *
  * Prismic repositories have no default repository, passing null as
  * parameters will always return null.
  *
  * @api
  */
 public function getRepository(array $parameters = null)
 {
     if (null === $parameters) {
         return null;
     }
     // check if we have all required keys
     $present = array_intersect_key(self::$required, $parameters);
     if (count(array_diff_key(self::$required, $present))) {
         return null;
     }
     $defined = array_intersect_key(array_merge(self::$required, self::$optional), $parameters);
     if (count(array_diff_key($defined, $parameters))) {
         return null;
     }
     if (isset($parameters['jackalope.factory'])) {
         $factory = $parameters['jackalope.factory'] instanceof FactoryInterface ? $parameters['jackalope.factory'] : new $parameters['jackalope.factory']();
     } else {
         $factory = new Factory();
     }
     $transport = $factory->get('Transport\\Prismic\\Client', array($parameters['jackalope.prismic_uri']));
     if (isset($parameters['jackalope.prismic_access_token'])) {
         $transport->setAccessToken($parameters['prismic_access_token']);
     }
     if (isset($parameters['jackalope.prismic_access_token'])) {
         $transport->setDefaultWorkspaceName($parameters['prismic_access_token']);
     }
     if (isset($parameters['jackalope.check_login_on_server'])) {
         $transport->setCheckLoginOnServer($parameters['jackalope.check_login_on_server']);
     }
     if (isset($parameters['jackalope.logger'])) {
         $transport = $factory->get('Transport\\Prismic\\LoggingClient', array($transport, $parameters['jackalope.logger']));
     }
     $options['stream_wrapper'] = empty($parameters['jackalope.disable_stream_wrapper']);
     if (isset($parameters[Session::OPTION_AUTO_LASTMODIFIED])) {
         $options[Session::OPTION_AUTO_LASTMODIFIED] = $parameters[Session::OPTION_AUTO_LASTMODIFIED];
     }
     return new Repository($factory, $transport, $options);
 }
 /**
  * Get a repository connected to the backend with the provided doctrine
  * dbal connection.
  *
  * {@inheritDoc}
  *
  * DoctrineDBAL repositories have no default repository, passing null as
  * parameters will always return null.
  *
  * @api
  */
 public function getRepository(array $parameters = null)
 {
     if (null === $parameters) {
         return null;
     }
     // check if we have all required keys
     $present = array_intersect_key(self::$required, $parameters);
     if (count(array_diff_key(self::$required, $present))) {
         return null;
     }
     $defined = array_intersect_key(array_merge(self::$required, self::$optional), $parameters);
     if (count(array_diff_key($defined, $parameters))) {
         return null;
     }
     if (isset($parameters['jackalope.factory'])) {
         $factory = $parameters['jackalope.factory'] instanceof FactoryInterface ? $parameters['jackalope.factory'] : new $parameters['jackalope.factory']();
     } else {
         $factory = new Factory();
     }
     $dbConn = $parameters['jackalope.doctrine_dbal_connection'];
     $transport = isset($parameters['jackalope.data_caches']) ? $factory->get('Transport\\DoctrineDBAL\\CachedClient', array($dbConn, $parameters['jackalope.data_caches'])) : $factory->get('Transport\\DoctrineDBAL\\Client', array($dbConn));
     if (isset($parameters['jackalope.check_login_on_server'])) {
         $transport->setCheckLoginOnServer($parameters['jackalope.check_login_on_server']);
     }
     if (isset($parameters['jackalope.uuid_generator'])) {
         $transport->setUuidGenerator($parameters['jackalope.uuid_generator']);
     }
     if (isset($parameters['jackalope.logger'])) {
         $transport = $factory->get('Transport\\DoctrineDBAL\\LoggingClient', array($transport, $parameters['jackalope.logger']));
     }
     $options['transactions'] = empty($parameters['jackalope.disable_transactions']);
     $options['stream_wrapper'] = empty($parameters['jackalope.disable_stream_wrapper']);
     if (isset($parameters[Session::OPTION_AUTO_LASTMODIFIED])) {
         $options[Session::OPTION_AUTO_LASTMODIFIED] = $parameters[Session::OPTION_AUTO_LASTMODIFIED];
     }
     return new Repository($factory, $transport, $options);
 }
Beispiel #9
0
 /**
  * {@inheritDoc}
  */
 public function query(Query $query)
 {
     $this->assertLoggedIn();
     if (!$query instanceof QueryObjectModelInterface) {
         $parser = new Sql2ToQomQueryConverter($this->factory->get('Query\\QOM\\QueryObjectModelFactory'));
         try {
             $qom = $parser->parse($query->getStatement());
             $qom->setLimit($query->getLimit());
             $qom->setOffset($query->getOffset());
         } catch (\Exception $e) {
             throw new InvalidQueryException('Invalid query: ' . $query->getStatement(), null, $e);
         }
     } else {
         $qom = $query;
     }
     // TODO: realize QOM handler
     //        $qomWalker = new QOMWalker($this->nodeTypeManager, $this->db->getConnection(), $this->getNamespaces());
     //        list($selectors, $selectorAliases, $sql) = $qomWalker->walkQOMQuery($qom);
 }