Skip to content

Commit

Permalink
Merge pull request #251 from sulu-io/hotfix/curl-options
Browse files Browse the repository at this point in the history
Added curl-options to configuration
  • Loading branch information
dbu committed Feb 19, 2016
2 parents 36ce280 + c853eaa commit 6d47b03
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

1.3.2
-----

* Added curl-options to configuration

1.3.1
-----

Expand Down
4 changes: 4 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ private function getPHPCRSessionsNode()
->useAttributeAsKey('key')
->prototype('scalar')->end()
->end()
->arrayNode('curl_options')
->useAttributeAsKey('key')
->prototype('scalar')->end()
->end()

// jackrabbit
->scalarNode('url')->end()
Expand Down
24 changes: 18 additions & 6 deletions DependencyInjection/DoctrinePHPCRExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@

namespace Doctrine\Bundle\PHPCRBundle\DependencyInjection;

use Doctrine\ODM\PHPCR\Version;
use Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension;
use Doctrine\ODM\PHPCR\Version;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;

/**
* PHPCR Extension.
Expand Down Expand Up @@ -210,6 +210,18 @@ private function loadJackalopeSession(array $session, ContainerBuilder $containe

// pipe additional parameters unchanged to jackalope
$backendParameters += $session['backend']['parameters'];
if (array_key_exists('curl_options', $session['backend']) && count($session['backend']['curl_options'])) {
$curlOptions = array();
foreach ($session['backend']['curl_options'] as $option => $value) {
if (!is_int($option)) {
$option = constant($option);
}

$curlOptions[$option] = $value;
}
$backendParameters['jackalope.jackrabbit_curl_options'] = $curlOptions;
}

// only set this default here when we know we are jackalope
if (!isset($backendParameters['jackalope.check_login_on_server'])) {
$backendParameters['jackalope.check_login_on_server'] = false;
Expand Down
4 changes: 4 additions & 0 deletions Tests/Unit/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function configurations()
'jackalope.default_header' => 'X-ID: %serverid%',
'jackalope.jackrabbit_expect' => true,
),
'curl_options' => array(),
'url' => 'http://localhost:8080/server/',
'backtrace' => false,
),
Expand Down Expand Up @@ -137,6 +138,7 @@ public function configurations()
'factory' => null,
'parameters' => array(
),
'curl_options' => array(),
'url' => 'http://a',
'backtrace' => false,
),
Expand All @@ -155,6 +157,7 @@ public function configurations()
'profiling' => false,
'parameters' => array(
),
'curl_options' => array(),
'url' => 'http://b',
'backtrace' => false,
'factory' => null,
Expand Down Expand Up @@ -238,6 +241,7 @@ public function configurations()
'jackalope.disable_stream_wrapper' => true,
'jackalope.disable_transactions' => true,
),
'curl_options' => array(),
),
'workspace' => 'default',
'username' => 'admin',
Expand Down

0 comments on commit 6d47b03

Please sign in to comment.