Doctrine\ODM\CouchDB\Tools\Console\Command\GenerateProxiesCommand::execute PHP Метод

execute() защищенный Метод

См. также: Console\Command\Command
protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
    {
        $dm = $this->getHelper('couchdb')->getDocumentManager();
        $metadatas = $dm->getMetadataFactory()->getAllMetadata();
        $metadatas = MetadataFilter::filter($metadatas, $input->getOption('filter'));
        // Process destination directory
        if (($destPath = $input->getArgument('dest-path')) === null) {
            $destPath = $dm->getConfiguration()->getProxyDir();
        }
        if (!is_dir($destPath)) {
            mkdir($destPath, 0777, true);
        }
        $destPath = realpath($destPath);
        if (!file_exists($destPath)) {
            throw new \InvalidArgumentException(sprintf("Proxies destination directory '<info>%s</info>' does not exist.", $destPath));
        } elseif (!is_writable($destPath)) {
            throw new \InvalidArgumentException(sprintf("Proxies destination directory '<info>%s</info>' does not have write permissions.", $destPath));
        }
        if (!count($metadatas)) {
            $output->write('No Metadata Classes to process.' . PHP_EOL);
            return;
        }
        foreach ($metadatas as $metadata) {
            $output->write(sprintf('Processing document "<info>%s</info>"', $metadata->name) . PHP_EOL);
        }
        // Acutally generate the Proxies
        $dm->getProxyFactory()->generateProxyClasses($metadatas, $destPath);
        $output->write(PHP_EOL . sprintf('Proxy classes generated to "<info>%s</INFO>"', $destPath) . PHP_EOL);
    }
GenerateProxiesCommand