Neos\ContentRepository\Domain\Service\NodeTypeManager::hasNodeType PHP Method

hasNodeType() public method

Checks if the specified node type exists
public hasNodeType ( string $nodeTypeName ) : boolean
$nodeTypeName string Name of the node type
return boolean TRUE if it exists, otherwise FALSE
    public function hasNodeType($nodeTypeName)
    {
        if ($this->cachedNodeTypes === array()) {
            $this->loadNodeTypes();
        }
        return isset($this->cachedNodeTypes[$nodeTypeName]);
    }

Usage Example

 /**
  * Repair inconsistent nodes
  *
  * This command analyzes and repairs the node tree structure and individual nodes
  * based on the current node type configuration.
  *
  * It is possible to execute only one or more specific checks by providing the <b>--skip</b>
  * or <b>--only</b> option. See the full description of checks further below for possible check
  * identifiers.
  *
  * The following checks will be performed:
  *
  * {pluginDescriptions}
  * <b>Examples:</b>
  *
  * ./flow node:repair
  *
  * ./flow node:repair --node-type Neos.NodeTypes:Page
  *
  * ./flow node:repair --workspace user-robert --only removeOrphanNodes,removeNodesWithInvalidDimensions
  *
  * ./flow node:repair --skip removeUndefinedProperties
  *
  * @param string $nodeType Node type name, if empty update all declared node types
  * @param string $workspace Workspace name, default is 'live'
  * @param boolean $dryRun Don't do anything, but report actions
  * @param boolean $cleanup If FALSE, cleanup tasks are skipped
  * @param string $skip Skip the given check or checks (comma separated)
  * @param string $only Only execute the given check or checks (comma separated)
  * @return void
  */
 public function repairCommand($nodeType = null, $workspace = 'live', $dryRun = false, $cleanup = true, $skip = null, $only = null)
 {
     $this->pluginConfigurations = self::detectPlugins($this->objectManager);
     if ($this->workspaceRepository->countByName($workspace) === 0) {
         $this->outputLine('Workspace "%s" does not exist', array($workspace));
         exit(1);
     }
     if ($nodeType !== null) {
         if ($this->nodeTypeManager->hasNodeType($nodeType)) {
             $nodeType = $this->nodeTypeManager->getNodeType($nodeType);
         } else {
             $this->outputLine('Node type "%s" does not exist', array($nodeType));
             exit(1);
         }
     }
     if ($dryRun) {
         $this->outputLine('Dry run, not committing any changes.');
     }
     if (!$cleanup) {
         $this->outputLine('Omitting cleanup tasks.');
     }
     foreach ($this->pluginConfigurations as $pluginConfiguration) {
         /** @var NodeCommandControllerPluginInterface $plugin */
         $plugin = $pluginConfiguration['object'];
         $this->outputLine('<b>' . $plugin->getSubCommandShortDescription('repair') . '</b>');
         $this->outputLine();
         $plugin->invokeSubCommand('repair', $this->output, $nodeType, $workspace, $dryRun, $cleanup, $skip, $only);
         $this->outputLine();
     }
     $this->outputLine('Node repair finished.');
 }
All Usage Examples Of Neos\ContentRepository\Domain\Service\NodeTypeManager::hasNodeType