Generates the path to write the class for the given ClassMetadataInfo instance.

@param ClassMetadataInfo $metadata

@return string
767553
protected function _generateOutputPath(ClassMetadataInfo $metadata)
    {
        return $this->_outputDir . '/' . str_replace('\\', '.', $metadata->name) . $this->_extension;
    }
598848
private function mapTranslatable(ClassMetadata $metadata)
    {
        // In the case A -> B -> TranslatableInterface, B might not have mapping defined as it
        // is probably defined in A, so in that case, we just return.
        if (!isset($this->configs[$metadata->name])) {
            return;
        }

        $metadata->mapOneToMany([
            'fieldName'     => 'translations',
            'targetEntity'  => $this->configs[$metadata->name],
            'mappedBy'      => 'translatable',
            'fetch'         => ClassMetadataInfo::FETCH_EXTRA_LAZY,
            'indexBy'       => 'locale',
            'cascade'       => ['persist', 'merge', 'refresh', 'remove'],
            'orphanRemoval' => true,
        ]);
    }
655407
public function generate($namespace, $basePath, ClassMetadata $metadata)
    {
        $entityName = $this->getEntityNameFromMetadata($metadata);
        $fileName = sprintf(
            '%s/Manager/%sManager.php',
            $basePath,
            $entityName
        );

        $parameters = array(
            'namespace' => $namespace,
            'entityName' => $entityName,
            'metadata' => $metadata,
        );

        return $this->renderFile('manager.php.twig', $fileName, $parameters);
    }
601850
protected function getInstance(ClassMetadata $metadata)
    {
        $reflection = new ReflectionClass($metadata->getName());
        $instance   = $reflection->newInstanceWithoutConstructor();

        return $instance;
    }
389795
protected function generateEntityEmbeddedProperties(ClassMetadataInfo $metadata)
    {
        $lines = array();

        foreach ($metadata->embeddedClasses as $fieldName => $embeddedClass) {
            if (isset($embeddedClass['declaredField']) || $this->hasProperty($fieldName, $metadata)) {
                continue;
            }

            $lines[] = $this->generateEmbeddedPropertyDocBlock($embeddedClass);
            $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldName . ";\n";
        }

        return implode("\n", $lines);
    }
1033157
public function transform(StreamMetaData $metadata): string
    {
        $this->replaceMagicDirFileConstants($metadata);
        $this->wrapReflectionGetFileName($metadata);

        // We should always vote abstain, because if there is only changes for magic constants, we can drop them
        return self::RESULT_ABSTAIN;
    }
695303
protected function generateDiscriminatorColumnAnnotation($metadata)
    {
        if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) {
            $discrColumn = $metadata->discriminatorColumn;
            $columnDefinition = 'name="' . $discrColumn['name']
                . '", type="' . $discrColumn['type']
                . '", length=' . $discrColumn['length'];

            return '@' . $this->annotationsPrefix . 'DiscriminatorColumn(' . $columnDefinition . ')';
        }
    }
681047
private function getClassMetadata()
    {
        if (null !== $this->metadata) {
            return $this->metadata;
        }

        return $this->metadata = $this->manager->getClassMetadata($this->getSource()->getClass());
    }
469994
private function mapTranslatable(ClassMetadata $metadata)
    {
        // In the case A -> B -> TranslatableInterface, B might not have mapping defined
        // as it is probably defined in A, so in that case, we just return.
        if (!isset($this->configs[$metadata->name])) {
            return;
        }

        $metadata->mapOneToMany([
            'fieldName'     => 'translations',
            'targetEntity'  => $this->configs[$metadata->name],
            'mappedBy'      => 'translatable',
            //'fetch'         => ClassMetadataInfo::FETCH_EXTRA_LAZY,
            'indexBy'       => 'locale',
            'cascade'       => ['persist', 'merge', 'refresh', 'remove', 'detach'],
            'orphanRemoval' => true,
        ]);

        $metadata->addEntityListener('preFlush', self::class, 'onTranslatablePreFlush');
    }
474131
private function getFieldsFromEntityMetadata(ClassMetadataInfo $metadata)
    {
        $fields = (array) $metadata->fieldNames;

        // Remove the primary key field if it's not managed manually
        if (!$metadata->isIdentifierNatural()) {
            $fields = array_diff($fields, $metadata->identifier);
        }

        return $fields;
    }
1053680
public function loadClassMetadata(Mapping\ClassMetadataInterface $metadata)
    {
        
        $reflClass = $metadata->getReflectionClass();
        
        //Iterate over properties to get annotations
        foreach($reflClass->getProperties() as $property) {
            
            $this->readProperty($property, $metadata);
            
        }
        
    }
817647
private function convertToClassMetadataInfo($className, $mappingInformation)
    {
        $metadata = new ClassMetadataInfo($className);

        $this->convertTableName($className, $mappingInformation, $metadata);
        $this->convertColumns($className, $mappingInformation, $metadata);
        $this->convertIndexes($className, $mappingInformation, $metadata);
        $this->convertRelations($className, $mappingInformation, $metadata);

        return $metadata;
    }
1255654
private function generateDocumentDocBlock(array $metadata)
    {
        return str_replace(
            ['<className>', '<annotation>', '<options>'],
            [
                $this->getClassName($metadata),
                ucfirst($metadata['annotation']),
                $metadata['annotation'] != 'object' ? ($metadata['type'] != lcfirst($this->getClassName($metadata))
                    ? sprintf('type="%s"', $metadata['type']) : '') : '',
            ],
            '/**
 * <className>
 *
 * @ES\<annotation>(<options>)
 */'
        );
    }
1287329
public function getAllClasses(MetaDataInterface $metadata = null)
    {
        $cacheFilename  = $this->directories['Cache'] . DIRECTORY_SEPARATOR;
        $cacheFilename .= md5('genrator_getAllClasses' . ($metadata !== null) ? get_class($metadata) : '');

        if ($this->fileManager->isFile($cacheFilename) === true && $this->noCache === false) {
            $data = unserialize($this->fileManager->fileGetContent($cacheFilename));
        } else {
            $data = $this->generatorFinder->getAllClasses($metadata);
            $this->fileManager->filePutsContent($cacheFilename, serialize($data));
        }

        return $data;
    }
827221
protected function generateDiscriminatorMapAnnotation($metadata)
    {
        if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) {
            $inheritanceClassMap = array();

            foreach ($metadata->discriminatorMap as $type => $class) {
                $inheritanceClassMap[] .= '"' . $type . '" = "' . $class . '"';
            }

            return '@' . $this->annotationsPrefix . 'DiscriminatorMap({' . implode(', ', $inheritanceClassMap) . '})';
        }
    }
92976
private function buildTable(Mapping\ClassMetadata $metadata)
    {
        $tableName     = $this->classToTableNames[$metadata->getClassName()];
        $indexes       = $this->tables[$tableName]->getIndexes();
        $tableMetadata = new Mapping\TableMetadata();

        $tableMetadata->setName($this->classToTableNames[$metadata->getClassName()]);

        foreach ($indexes as $index) {
            /** @var Index $index */
            if ($index->isPrimary()) {
                continue;
            }

            $tableMetadata->addIndex([
                'name'    => $index->getName(),
                'columns' => $index->getColumns(),
                'unique'  => $index->isUnique(),
                'options' => $index->getOptions(),
                'flags'   => $index->getFlags(),
            ]);
        }

        $metadata->setTable($tableMetadata);
    }
896907
protected function generateEntityLifecycleCallbackMethods(ClassMetadataInfo $metadata)
    {
        if (isset($metadata->lifecycleCallbacks) && $metadata->lifecycleCallbacks) {
            $methods = array();

            foreach ($metadata->lifecycleCallbacks as $name => $callbacks) {
                foreach ($callbacks as $callback) {
                    if ($code = $this->generateLifecycleCallbackMethod($name, $callback, $metadata)) {
                        $methods[] = $code;
                    }
                }
            }

            return implode("\n\n", $methods);
        }

        return "";
    }