Create a unique command name

@param MethodMeta $methodMeta
@param ClassMeta $classMeta
@return string
9983
protected function getCommandName($methodMeta, $classMeta)
    {
        $nameSpaceParts = explode('\\', $classMeta->getNamespace());
        $vendor = $nameSpaceParts[0];
        $package = $nameSpaceParts[1];

        return strtolower($vendor . ':' . $package . ':' . str_replace(self::COMMAND_SUFFIX, '', $methodMeta->getName()));
    }
39785
public static function getMethodAnnotations($className, $methodName, $annotationClassName = null)
    {
        if(!isset(static::$annotations[$className]['Methods'][$methodName]))
        {
            return [];
        }
        if(null === $annotationClassName)
        {
            return static::$annotations[$className]['Methods'][$methodName];
        }
        else
        {
            $result = [];
            foreach(static::$annotations[$className]['Methods'][$methodName] as $annotation)
            {
                if($annotation instanceof $annotationClassName)
                {
                    $result[] = $annotation;
                }
            }
            return $result;
        }
    }
1324260
protected function generateEntityClassName(ClassMetadataInfo $metadata)
    {
        return 'class ' . $this->getClassName($metadata) .
        ($this->extendsClass() ? ' extends ' . $this->getClassToExtendName() : null) .
        ($this->interfaceClass() ? ' implements ' . $this->getClassToInterfaceName() : null);
    }
626551
function withMeta($data)
    {
        $meta = $this->_assertMetaData($data);

        $new = clone $this;
        $new->meta = array_merge($this->meta, $meta);
        return $new;
    }
122037
public function GenerateExtraMeta()
    {
        if ($this->owner->ExtraMeta) {
            return $this->owner->ExtraMeta . PHP_EOL;
        } else {
            return $this->owner->MarkupComment('none');
        }
    }
1223783
protected function makeMeta(string $key = '', $value = '') : Meta
    {
        $className = $this->getMetaClassName();

        $meta = new $className([
            'key'   => $key,
            'value' => $value,
        ]);

        return $meta;
    }
832889
private function freshOrNull(ClassMetadata $classMetadata = null)
    {
        if (null === $classMetadata) {
            return;
        }

        return $this->freshnessValidator->isFresh($classMetadata) ? $classMetadata : null;
    }
664258
public function write(ClassMetadata $classMetadata, string $code)
    {
        return \file_put_contents($this->configuration->getFilename($classMetadata), $code) > 0;
    }
1355015
private function createCollection(DocumentManager $documentManager, ClassMetadata $classMetadata, $collectionName)
    {

        $database = $documentManager->getDatabase();

        $exists = false;
        foreach ($database->listCollections() as $collection) {
            if ($collection->getName() == $collectionName) {
                $exists = true;
            }
        }

        $creationOptions = $classMetadata->getCollectionCreationOptions();
        if (!empty($creationOptions) && !$exists) {
            $database->createCollection($collectionName, $creationOptions);
        }

        $collectionOptions = $classMetadata->getCollectionOptions();

        return $database->selectCollection($collectionName, $collectionOptions);
    }
1164206
public function generateUpdatedEntityClass(ClassMetadataInfo $metadata, $path)
    {
        $currentCode = file_get_contents($path);

        $body = $this->generateEntityBody($metadata);
        $body = str_replace('<spaces>', $this->spaces, $body);
        $last = strrpos($currentCode, '}');

        return substr($currentCode, 0, $last) . $body . (strlen($body) > 0 ? "\n" : '') . "}\n";
    }
1211910
private function createItemFromMetadata(Metadata $meta)
    {
        $config = $meta->getConfiguration();
        $entityClass = $meta->getEntityClass();

        $item = (new Item($meta->getEntityName()))
            ->setIndexTitle($meta->getBaseTranslationPrefix().'action.index.link')
            ->setNewTitle($meta->getBaseTranslationPrefix().'action.new.link')
            ->setDescription($meta->getBaseTranslationPrefix().'menu.description')
            ->setMainColor($config['menu']['colors']['main'])
            ->setSidebarColor($config['menu']['colors']['sidebar'])
            ->setMainIcon($config['menu']['icons']['main'])
            ->setSidebarIcon($config['menu']['icons']['sidebar'])
            ->setPosition($config['menu']['position'])
            ->setAssociatedObject($entityClass)
            ->setParentName($config['menu']['group']);

        if ($this->authorizationChecker->isGranted(Permission::VIEW, $entityClass)
            && $this->adminRouter->isRouteExists($entityClass, AdminRouter::TYPE_INDEX)
        ) {
            $item->setIndexUrl($this->adminRouter->generate(null, $entityClass, AdminRouter::TYPE_INDEX, [], UrlGeneratorInterface::ABSOLUTE_PATH, false));
        }
        if ($this->authorizationChecker->isGranted(Permission::CREATE_DELETE, $entityClass)
            && $this->adminRouter->isRouteExists($entityClass, AdminRouter::TYPE_NEW)
        ) {
            $item->setNewUrl($this->adminRouter->generate(null, $entityClass, AdminRouter::TYPE_NEW, [], UrlGeneratorInterface::ABSOLUTE_PATH, false));
        }

        return $item;
    }
773366
public function generateEntityClass(EntityMetadata $meta)
    {
        $placeholders = array(
            '<namespace>',
            '<classAnnotations>',
            '<className>',
            '<implements>',
            '<traits>'
        );

        $replacements = array(
            $this->namespace,
            $this->generateClassAnnotations($meta->getTraits()),
            $meta->getClassName(),
            $this->generateImplements($meta->getInterfaces()),
            $this->generateTraitStatements($meta->getTraits())
        );

        $code = str_replace($placeholders, $replacements, self::$template);
        return str_replace('<spaces>', self::$spaces, $code);
    }
1158524
protected function buildShowMeta($showMeta, &$params)
    {
        if (empty($showMeta)) {
            return '';
        }
        $sql = 'SHOW META';
        if (is_bool($showMeta)) {
            return $sql;
        }

        if ($showMeta instanceof Expression) {
            foreach ($showMeta->params as $n => $v) {
                $params[$n] = $v;
            }
            $phName = $showMeta->expression;
        } else {
            $phName = self::PARAM_PREFIX . count($params);
            $escape = ['%'=>'\%', '_'=>'\_', '\\'=>'\\\\'];
            $params[$phName] = '%' . strtr($showMeta, $escape) . '%';
        }

        $sql .= " LIKE {$phName}";
        return $sql;
    }
354504
private function generateMagicSet(ClassMetadata $class)
    {
        $lazyPublicProperties = $this->getLazyLoadedPublicProperties($class);
        $hasParentSet         = $class->getReflectionClass()->hasMethod('__set');

        if (empty($lazyPublicProperties) && ! $hasParentSet) {
            return '';
        }

        $inheritDoc = $hasParentSet ? '{@inheritDoc}' : '';
        $magicSet   = <<<EOT
    /**
     * $inheritDoc
     * @param string \$name
     * @param mixed  \$value
     */
    public function __set(\$name, \$value)
    {

EOT;

        if ( ! empty($lazyPublicProperties)) {
            $magicSet .= <<<'EOT'
        if (array_key_exists($name, $this->__getLazyProperties())) {
            $this->__initializer__ && $this->__initializer__->__invoke($this, '__set', [$name, $value]);

            $this->$name = $value;

            return;
        }


EOT;
        }

        if ($hasParentSet) {
            $magicSet .= <<<'EOT'
        $this->__initializer__ && $this->__initializer__->__invoke($this, '__set', [$name, $value]);

        return parent::__set($name, $value);
EOT;
        } else {
            $magicSet .= "        \$this->\$name = \$value;";
        }

        $magicSet .= "\n    }";

        return $magicSet;
    }
458871
private function buildIndexes(ClassMetadataInfo $metadata)
    {
        $tableName = $metadata->table['name'];
        $indexes   = $this->tables[$tableName]->getIndexes();

        foreach($indexes as $index){
            if ($index->isPrimary()) {
                continue;
            }

            $indexName      = $index->getName();
            $indexColumns   = $index->getColumns();
            $constraintType = $index->isUnique()
                ? 'uniqueConstraints'
                : 'indexes';

            $metadata->table[$constraintType][$indexName]['columns'] = $indexColumns;
        }
    }
471047
private function getAssociationColumnName(ClassMetadata $meta, $fieldName)
    {
        $mapping = $meta->getAssociationMapping($fieldName);

        return current($mapping['joinColumnFieldNames']);
    }
1237753
public function getTableName(ClassMetadataInfo $metadata)
    {
        $tableName = $metadata->getTableName();

        //## Fix for doctrine/orm >= 2.5
        if (method_exists($metadata, 'getSchemaName') && $metadata->getSchemaName()) {
            $tableName = $metadata->getSchemaName() . '.' . $tableName;
        }

        return $this->getTablePrefix() . $tableName . $this->getTableSuffix();
    }