Skip to content

Commit 47281c1

Browse files
committed
Load the profile after setting the config from the Input
1 parent fa90a41 commit 47281c1

File tree

7 files changed

+16
-10
lines changed

7 files changed

+16
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ dev-master
88
### Bug fixes
99

1010
- [embedded] No exit code returned
11+
- [profile] Profile configuration overwritten by session parameters
1112

1213
beta1
1314
-----

src/PHPCR/Shell/Config/Profile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function get($domain, $key = null)
8080
$this->validateDomain($domain);
8181

8282
if (null === $key) {
83-
return $this->profile[$domain];
83+
return new Config($this->profile[$domain]);
8484
}
8585

8686
if (!isset($this->profile[$domain][$key])) {

src/PHPCR/Shell/DependencyInjection/Container.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ public function registerPhpcr()
104104
public function registerEvent()
105105
{
106106
if ($this->mode === PhpcrShell::MODE_STANDALONE) {
107+
$this->register(
108+
'event.subscriber.profile_from_session_input',
109+
'PHPCR\Shell\Subscriber\ProfileFromSessionInputSubscriber'
110+
)->addTag('event.subscriber');
111+
107112
$this->register(
108113
'event.subscriber.profile_loader',
109114
'PHPCR\Shell\Subscriber\ProfileLoaderSubscriber'
@@ -112,11 +117,6 @@ public function registerEvent()
112117
->addArgument(new Reference('helper.question'))
113118
->addTag('event.subscriber');
114119

115-
$this->register(
116-
'event.subscriber.profile_from_session_input',
117-
'PHPCR\Shell\Subscriber\ProfileFromSessionInputSubscriber'
118-
)->addTag('event.subscriber');
119-
120120
$this->register(
121121
'event.subscriber.profile_writer',
122122
'PHPCR\Shell\Subscriber\ProfileWriterSubscriber'

src/PHPCR/Shell/Transport/Transport/DoctrineDbal.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\DBAL\DriverManager;
1515
use Jackalope\RepositoryFactoryDoctrineDBAL;
1616
use PHPCR\Shell\Transport\TransportInterface;
17+
use PHPCR\Shell\Config\Config;
1718

1819
class DoctrineDbal implements TransportInterface
1920
{
@@ -22,7 +23,7 @@ public function getName()
2223
return 'doctrine-dbal';
2324
}
2425

25-
public function getRepository(array $config)
26+
public function getRepository(Config $config)
2627
{
2728
$connection = DriverManager::getConnection($ops = array(
2829
'user' => $config['db_username'],

src/PHPCR/Shell/Transport/Transport/JackalopeFs.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPCR\Shell\Transport\TransportInterface;
1515
use Jackalope\RepositoryFactoryFilesystem;
16+
use PHPCR\Shell\Config\Config;
1617

1718
class JackalopeFs implements TransportInterface
1819
{
@@ -21,7 +22,7 @@ public function getName()
2122
return 'jackalope-fs';
2223
}
2324

24-
public function getRepository(array $config)
25+
public function getRepository(Config $config)
2526
{
2627
$params = array(
2728
'path' => $config['repo_path'],

src/PHPCR/Shell/Transport/Transport/Jackrabbit.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Jackalope\RepositoryFactoryJackrabbit;
1515
use PHPCR\Shell\Transport\TransportInterface;
16+
use PHPCR\Shell\Config\Config;
1617

1718
class Jackrabbit implements TransportInterface
1819
{
@@ -21,7 +22,7 @@ public function getName()
2122
return 'jackrabbit';
2223
}
2324

24-
public function getRepository(array $config)
25+
public function getRepository(Config $config)
2526
{
2627
$params = array(
2728
'jackalope.jackrabbit_uri' => $config['repo_url'],

src/PHPCR/Shell/Transport/TransportInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace PHPCR\Shell\Transport;
1313

14+
use PHPCR\Shell\Config\Config;
15+
1416
/**
1517
* All phpcr-shell transports must implement this interface
1618
*
@@ -20,5 +22,5 @@ interface TransportInterface
2022
{
2123
public function getName();
2224

23-
public function getRepository(array $config);
25+
public function getRepository(Config $config);
2426
}

0 commit comments

Comments
 (0)