public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
    {
        /** @var ClassMetadata $classMetadata */
        $classMetadata = $eventArgs->getClassMetadata();

        if (null === $classMetadata->getReflectionClass() ||
            false == $this->isModular($classMetadata) ||
            'Harmony\Component\ModularRouting\StaticModule' == $this->getModuleClass() ||
            $classMetadata->hasField('module') || $classMetadata->hasAssociation('module')) {

            return;
        }

        $classMetadata->mapManyToOne([
            'targetEntity' => $this->getModuleClass(),
            'fieldName'    => 'module',
            'joinColumns'  => [
                [
                    'name'                 => 'module_id',
                    'referencedColumnName' => 'id',
                ],
            ],
        ]);
    }
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
    {
        /** @var ClassMetadata $classMetadata */
        $classMetadata = $eventArgs->getClassMetadata();

        if (null === $classMetadata->getReflectionClass() ||
            false == $this->isModular($classMetadata) ||
            'Harmony\Component\ModularRouting\StaticModule' == $this->getModuleClass() ||
            $classMetadata->hasField('module') || $classMetadata->hasAssociation('module')) {

            return;
        }

        $classMetadata->mapManyToOne([
            'targetEntity' => $this->getModuleClass(),
            'fieldName'    => 'module',
            'joinColumns'  => [
                [
                    'name'                 => 'module_id',
                    'referencedColumnName' => 'id',
                ],
            ],
        ]);
    }
public function loadClassMetadata ( LoadClassMetadataEventArgs $ eventArgs ) { /** @var ClassMetadata $classMetadata */ $ classMetadata = $ eventArgs -> getClassMetadata ( ) ; if ( null === $ classMetadata -> getReflectionClass ( ) || false == $ this -> isModular ( $ classMetadata ) || 'Harmony\Component\ModularRouting\StaticModule' == $ this -> getModuleClass ( ) || $ classMetadata -> hasField ( 'module' ) || $ classMetadata -> hasAssociation ( 'module' ) ) { return ; } $ classMetadata -> mapManyToOne ( [ 'targetEntity' => $ this -> getModuleClass ( ) , 'fieldName' => 'module' , 'joinColumns' => [ [ 'name' => 'module_id' , 'referencedColumnName' => 'id' , ] , ] , ] ) ; }
Handles actions when metadata is loaded.

Creates an association for entities that inherit ModularTrait.

@param LoadClassMetadataEventArgs $eventArgs
Handles actions when metadata is loaded .