Skip to content

Commit b3bdc11

Browse files
committed
Added [add|remove]-mixin options
1 parent 5531c7e commit b3bdc11

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/PHPCR/Util/Console/Command/TouchCommand.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ protected function configure()
6767
InputOption::VALUE_NONE,
6868
'Dump a string reperesentation of the created / modified node.'
6969
)
70+
->addOption('add-mixin', null,
71+
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
72+
'Add a mixin to the node'
73+
)
74+
->addOption('remove-mixin', null,
75+
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
76+
'Add a mixin to the node'
77+
)
7078
->setDescription('Create or modify a node')
7179
->setHelp(<<<HERE
7280
This command allows you to create or modify a node at the specified path.
@@ -98,6 +106,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
98106
$sets = $input->getOption('set');
99107
$unsets = $input->getOption('unset');
100108
$dump = $input->getOption('dump');
109+
$addMixins = $input->getOption('add-mixin');
110+
$removeMixins = $input->getOption('remove-mixin');
101111

102112
try {
103113
$node = $session->getNode($path);
@@ -158,6 +168,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
158168
$node->setProperty($unset, null);
159169
}
160170

171+
foreach ($addMixins as $addMixin) {
172+
$node->addMixin($addMixin);
173+
}
174+
175+
foreach ($removeMixins as $removeMixin) {
176+
$node->removeMixin($removeMixin);
177+
}
178+
161179
if ($dump) {
162180
$output->writeln('<info>Node dump: </info>');
163181
foreach ($node->getProperties() as $property) {

0 commit comments

Comments
 (0)