public function loadClassMetadata(LoadClassMetadataEventArgs $args)
    {
        if (empty($this->prefix)) {
            return;
        }

        /** @var ClassMetadata $classMetadata */
        $classMetadata = $args->getClassMetadata();

        if (false === strpos($classMetadata->getTableName(), $this->prefix)) {
            $tableName = $this->prefix . $classMetadata->getTableName();
            $classMetadata->setPrimaryTable(['name' => $tableName]);
        }

        foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
            if ($mapping['type'] == ClassMetadataInfo::MANY_TO_MANY && $mapping['isOwningSide'] === true) {
                $mappedTableName = $classMetadata->associationMappings[$fieldName]['joinTable']['name'];

                if (false !== strpos($mappedTableName, $this->prefix)) {
                    continue;
                }

                $classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->prefix . $mappedTableName;
            }
        }
    }
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
    {
        if (empty($this->prefix)) {
            return;
        }

        /** @var ClassMetadata $classMetadata */
        $classMetadata = $args->getClassMetadata();

        if (false === strpos($classMetadata->getTableName(), $this->prefix)) {
            $tableName = $this->prefix . $classMetadata->getTableName();
            $classMetadata->setPrimaryTable(['name' => $tableName]);
        }

        foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
            if ($mapping['type'] == ClassMetadataInfo::MANY_TO_MANY && $mapping['isOwningSide'] === true) {
                $mappedTableName = $classMetadata->associationMappings[$fieldName]['joinTable']['name'];

                if (false !== strpos($mappedTableName, $this->prefix)) {
                    continue;
                }

                $classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->prefix . $mappedTableName;
            }
        }
    }
public function loadClassMetadata ( LoadClassMetadataEventArgs $ args ) { if ( empty ( $ this -> prefix ) ) { return ; } /** @var ClassMetadata $classMetadata */ $ classMetadata = $ args -> getClassMetadata ( ) ; if ( false === strpos ( $ classMetadata -> getTableName ( ) , $ this -> prefix ) ) { $ tableName = $ this -> prefix . $ classMetadata -> getTableName ( ) ; $ classMetadata -> setPrimaryTable ( [ 'name' => $ tableName ] ) ; } foreach ( $ classMetadata -> getAssociationMappings ( ) as $ fieldName => $ mapping ) { if ( $ mapping [ 'type' ] == ClassMetadataInfo :: MANY_TO_MANY && $ mapping [ 'isOwningSide' ] === true ) { $ mappedTableName = $ classMetadata -> associationMappings [ $ fieldName ] [ 'joinTable' ] [ 'name' ] ; if ( false !== strpos ( $ mappedTableName , $ this -> prefix ) ) { continue ; } $ classMetadata -> associationMappings [ $ fieldName ] [ 'joinTable' ] [ 'name' ] = $ this -> prefix . $ mappedTableName ; } } }
Load class meta data event

@param LoadClassMetadataEventArgs $args

@return void
Load class meta data event