Skip to content

Commit

Permalink
integrate the convert translations command
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Nov 6, 2015
1 parent de7182c commit 6a5f2fe
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 10 deletions.
2 changes: 2 additions & 0 deletions DoctrinePHPCRBundle.php
Expand Up @@ -20,6 +20,7 @@

namespace Doctrine\Bundle\PHPCRBundle;

use Doctrine\Bundle\PHPCRBundle\OptionalCommand\ODM\DocumentConvertTranslationCommand;
use Symfony\Component\DependencyInjection\IntrospectableContainerInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
Expand Down Expand Up @@ -66,6 +67,7 @@ public function registerCommands(Application $application)
$application->add(new DocumentMigrateClassCommand());
$application->add(new InfoDoctrineCommand());
$application->add(new VerifyUniqueNodeTypesMappingCommand());
$application->add(new DocumentConvertTranslationCommand());
}

if (class_exists('\Jackalope\Tools\Console\Command\JackrabbitCommand')) {
Expand Down
67 changes: 67 additions & 0 deletions OptionalCommand/ODM/DocumentConvertTranslationCommand.php
@@ -0,0 +1,67 @@
<?php

/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\Bundle\PHPCRBundle\OptionalCommand\ODM;

use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\ODM\PHPCR\Tools\Console\Command\DocumentConvertTranslationCommand as BaseDocumentConvertTranslationCommand;
use Doctrine\Bundle\PHPCRBundle\Command\DoctrineCommandHelper;

/**
* Integrate command into symfony.
*
* @author David Buchmann <mail@davidbu.ch>
*/
class DocumentConvertTranslationCommand extends BaseDocumentConvertTranslationCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
{
parent::configure();

$this
->addOption('session', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.', null)
->setHelp($this->getHelp().<<<EOT
If you are using multiple document managers you can pick your choice with the
<info>--session</info> option:
<info>php app/console doctrine:phpcr:document:convert-translation --session=default</info>
EOT
);
}

/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommandHelper::setApplicationDocumentManager(
$this->getApplication(),
$input->getOption('session')
);

return parent::execute($input, $output);
}
}
8 changes: 1 addition & 7 deletions OptionalCommand/ODM/InfoDoctrineCommand.php
Expand Up @@ -41,14 +41,8 @@ protected function configure()
parent::configure();

$this
->setName('doctrine:phpcr:mapping:info')
->addOption('session', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.', null)
->setHelp(<<<EOT
The <info>doctrine:phpcr:mapping:info</info> shows basic information about which
entities exist and possibly if their mapping information contains errors or
not.
<info>php app/console doctrine:phpcr:mapping:info</info>
->setHelp($this->getHelp().<<<EOT
If you are using multiple document managers you can pick your choice with the
<info>--session</info> option:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Expand Up @@ -35,9 +35,9 @@
},
"suggest": {
"phpcr/phpcr-shell": "If you want native access to PHPCR-Shell to manage the PHPCR repository",
"doctrine/phpcr-odm": "if you want to use the odm as well. require version ~1.1",
"jackalope/jackalope-jackrabbit": "if you want to connect to jackrabbit. require version ~1.0.1",
"jackalope/jackalope-doctrine-dbal": "if you want to use jackalope-doctrine-dbal. require version 1.0.*",
"doctrine/phpcr-odm": "if you want to use the odm as well. require version ^1.3",
"jackalope/jackalope-jackrabbit": "if you want to connect to jackrabbit. require version ^1.3",
"jackalope/jackalope-doctrine-dbal": "if you want to use jackalope-doctrine-dbal. require version ^1.3",
"doctrine/data-fixtures": "if you want to use the fixture loading.",
"doctrine/doctrine-bundle": "when using jackalope-doctrine-dbal",
"burgov/key-value-form-bundle": "to edit assoc multivalue properties. require version 1.0.*"
Expand Down

0 comments on commit 6a5f2fe

Please sign in to comment.