Skip to content

Commit

Permalink
added curl-options configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes committed Feb 19, 2016
1 parent 703b2b0 commit c853eaa
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,11 @@
Changelog
=========

1.3.2
-----

* Added curl-options to configuration

1.3.1
-----

Expand Down
2 changes: 1 addition & 1 deletion Command/LoadFixtureCommand.php
Expand Up @@ -56,7 +56,7 @@ protected function configure()
->addOption('no-initialize', null, InputOption::VALUE_NONE, 'Do not run the repository initializers after purging the repository.')
->addOption('session', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command (deprecated, alias for dm)')
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command')
->setHelp(<<<EOT
->setHelp(<<<'EOT'
The <info>doctrine:phpcr:fixtures:load</info> command loads data fixtures from
your bundles DataFixtures/PHPCR directory:
Expand Down
2 changes: 1 addition & 1 deletion Command/MigratorMigrateCommand.php
Expand Up @@ -40,7 +40,7 @@ protected function configure()
->addOption('identifier', null, InputOption::VALUE_OPTIONAL, 'Path or UUID of the node to dump', '/')
->addOption('depth', null, InputOption::VALUE_OPTIONAL, 'Set to a number to limit how deep into the tree to recurse', '-1')
->addOption('session', null, InputOption::VALUE_OPTIONAL, 'The session to use for this command')
->setHelp(<<<EOT
->setHelp(<<<'EOT'
To find the available 'migrators' run this command without an input argument
EOT
)
Expand Down
2 changes: 1 addition & 1 deletion Command/NodeTypeRegisterCommand.php
Expand Up @@ -38,7 +38,7 @@ class NodeTypeRegisterCommand extends BaseRegisterNodeTypesCommand
protected function configure()
{
parent::configure();
$newHelp = <<<EOT
$newHelp = <<<'EOT'
If no cnd-files are specified, the command will automatically try and find node files in the
Expand Down
2 changes: 1 addition & 1 deletion Command/PhpcrShellCommand.php
Expand Up @@ -41,7 +41,7 @@ protected function configure()
$this->addArgument('cmd', InputArgument::IS_ARRAY);
$this->addOption('session', null, InputOption::VALUE_OPTIONAL, 'The session to use for this command');
$this->setDescription('Proxy for an embedded PHPCR Shell. Commands should be quoted');
$this->setHelp(<<<EOT
$this->setHelp(<<<'EOT'
This command will send commands to an embedded PHPCR shell. For it to work you
will need to have the phpcr-shell dependency installed.
Expand Down
2 changes: 1 addition & 1 deletion Command/RepositoryInitCommand.php
Expand Up @@ -52,7 +52,7 @@ protected function configure()
->setName('doctrine:phpcr:repository:init')
->addOption('session', null, InputOption::VALUE_OPTIONAL, 'The session to use for this command')
->setDescription('Initialize the PHPCR repository.')
->setHelp(<<<EOT
->setHelp(<<<'EOT'
Run all initializers tagged with doctrine_phpcr.initializer to create documents
or base paths so the application can work. If phpcr-odm is present, also runs
the doctrine:phpcr:register-system-node-types command.
Expand Down
4 changes: 4 additions & 0 deletions DependencyInjection/Configuration.php
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
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
2 changes: 1 addition & 1 deletion OptionalCommand/Jackalope/JackrabbitCommand.php
Expand Up @@ -65,7 +65,7 @@ protected function configure()

$this
->setName('doctrine:phpcr:jackrabbit')
->setHelp(<<<EOF
->setHelp(<<<'EOF'
The <info>doctrine:phpcr:jackrabbit</info> command allows to have a minimal control on the Jackrabbit server from within a
Symfony 2 command.
Expand Down
2 changes: 1 addition & 1 deletion OptionalCommand/ODM/DocumentConvertTranslationCommand.php
Expand Up @@ -42,7 +42,7 @@ protected function configure()

$this
->addOption('session', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.', null)
->setHelp($this->getHelp().<<<EOT
->setHelp($this->getHelp().<<<'EOT'
If you are using multiple document managers you can pick your choice with the
<info>--session</info> option:
Expand Down
2 changes: 1 addition & 1 deletion OptionalCommand/ODM/InfoDoctrineCommand.php
Expand Up @@ -42,7 +42,7 @@ protected function configure()

$this
->addOption('session', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.', null)
->setHelp($this->getHelp().<<<EOT
->setHelp($this->getHelp().<<<'EOT'
If you are using multiple document managers you can pick your choice with the
<info>--session</info> option:
Expand Down
Expand Up @@ -42,7 +42,7 @@ protected function configure()
->setName('doctrine:phpcr:mapping:verify-unique-node-types')
->setDescription('Verify that documents claiming to have unique node types are truly unique')
->addOption('session', null, InputOption::VALUE_OPTIONAL, 'The session to use for this command')
->setHelp(<<<EOT
->setHelp(<<<'EOT'
The <info>%command.name%</info> command checks all mapped PHPCR-ODM documents
and verifies that any claiming to use unique node types are truly unique.
EOT
Expand Down
4 changes: 4 additions & 0 deletions Tests/Unit/DependencyInjection/ConfigurationTest.php
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 c853eaa

Please sign in to comment.