/** * {@inheritdoc} */ public function warmUp($cacheDir) { $helper = new UniqueNodeTypeHelper(); foreach ($this->registry->getManagers() as $documentManager) { $helper->checkNodeTypeMappings($documentManager); } }
/** * {@inheritDoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $documentManager = $this->getHelper('phpcr')->getDocumentManager(); $uniqueNodeTypeHelper = new UniqueNodeTypeHelper(); $debugInformation = $uniqueNodeTypeHelper->checkNodeTypeMappings($documentManager); if (OutputInterface::VERBOSITY_DEBUG <= $output->getVerbosity()) { foreach ($debugInformation as $className => $debug) { $output->writeln(sprintf('The document <info>%s</info> uses %snode type <info>%s</info>', $className, $debug['unique_node_type'] ? '<comment>uniquely mapped</comment> ' : '', $debug['node_type'])); } } return 0; }
/** * Verify that no exception results from a correctly-mapped set * of documents. */ public function testCheckNodeTypeMappingsWithoutDuplicate() { $metadataA = new ClassMetadata('Doctrine\\PHPCR\\Models\\ClassA'); $metadataA->setNodeType('nt:unstructured'); $metadataB = new ClassMetadata('Doctrine\\PHPCR\\Models\\ClassB'); $metadataB->setNodeType('custom:type'); $metadataB->setUniqueNodeType(true); $metadataC = new ClassMetadata('Doctrine\\PHPCR\\Models\\ClassC'); $metadataA->setNodeType('nt:unstructured'); $documentManager = $this->configureDocumentManager(array($metadataA, $metadataB, $metadataC)); $uniqueNodeTypeHelper = new UniqueNodeTypeHelper(); $uniqueNodeTypeHelper->checkNodeTypeMappings($documentManager); }