| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * This file is part of the Doctrine MongoDBBundle | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * The code was originally distributed inside the Symfony framework. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * (c) Fabien Potencier <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * (c) Doctrine Project | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * For the full copyright and license information, please view the LICENSE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * file that was distributed with this source code. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | namespace Saxulum\DoctrineMongodbOdmCommands\Command; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use Doctrine\ODM\MongoDB\Tools\Console\Command\GenerateProxiesCommand; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use Symfony\Component\Console\Input\InputInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | use Symfony\Component\Console\Input\InputOption; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | use Symfony\Component\Console\Output\OutputInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * Generate the Doctrine ORM document proxies to your cache directory. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  * @author Fabien Potencier <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  * @author Jonathan H. Wage <[email protected]> | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 27 |  |  |  */ | 
            
                                                                        
                            
            
                                                                    
                                                                                                        
            
            
                | 28 |  | View Code Duplication | class GenerateProxiesDoctrineODMCommand extends GenerateProxiesCommand | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     protected function configure() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         parent::configure(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         $this | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |             ->setName('doctrine:mongodb:generate:proxies') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |             ->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |             ->setHelp(<<<EOT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | The <info>doctrine:mongodb:generate:proxies</info> command generates proxy classes for your default document manager: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |   <info>./app/console doctrine:mongodb:generate:proxies</info> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | You can specify the document manager you want to generate the proxies for: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |   <info>./app/console doctrine:mongodb:generate:proxies --dm=name</info> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | EOT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |             ); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 47 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     protected function execute(InputInterface $input, OutputInterface $output) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         DoctrineCommandHelper::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         return parent::execute($input, $output); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 54 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 55 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 56 |  |  |  | 
            
                        
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.