src/Sulu/Component/Persistence/EventSubscriber/ORM/UserBlameSubscriber.php
public function loadClassMetadata(LoadClassMetadataEventArgs $event)
    {
        $metadata = $event->getClassMetadata();
        $reflection = $metadata->getReflectionClass();

        if (null !== $reflection && $reflection->implementsInterface('Sulu\Component\Persistence\Model\UserBlameInterface')) {
            if (!$metadata->hasAssociation(self::CREATOR_FIELD)) {
                $metadata->mapManyToOne([
                    'fieldName' => self::CREATOR_FIELD,
                    'targetEntity' => $this->userClass,
                    'joinColumns' => [
                        [
                            'name' => 'idUsersCreator',
                            'onDelete' => 'SET NULL',
                            'referencedColumnName' => 'id',
                            'nullable' => true,
                        ],
                    ],
                ]);
            }

            if (!$metadata->hasAssociation(self::CHANGER_FIELD)) {
                $metadata->mapManyToOne([
                    'fieldName' => self::CHANGER_FIELD,
                    'targetEntity' => $this->userClass,
                    'joinColumns' => [
                        [
                            'name' => 'idUsersChanger',
                            'onDelete' => 'SET NULL',
                            'referencedColumnName' => 'id',
                            'nullable' => true,
                        ],
                    ],
                ]);
            }
        }
    }
public function loadClassMetadata(LoadClassMetadataEventArgs $event)
    {
        $metadata = $event->getClassMetadata();
        $reflection = $metadata->getReflectionClass();

        if (null !== $reflection && $reflection->implementsInterface('Sulu\Component\Persistence\Model\UserBlameInterface')) {
            if (!$metadata->hasAssociation(self::CREATOR_FIELD)) {
                $metadata->mapManyToOne([
                    'fieldName' => self::CREATOR_FIELD,
                    'targetEntity' => $this->userClass,
                    'joinColumns' => [
                        [
                            'name' => 'idUsersCreator',
                            'onDelete' => 'SET NULL',
                            'referencedColumnName' => 'id',
                            'nullable' => true,
                        ],
                    ],
                ]);
            }

            if (!$metadata->hasAssociation(self::CHANGER_FIELD)) {
                $metadata->mapManyToOne([
                    'fieldName' => self::CHANGER_FIELD,
                    'targetEntity' => $this->userClass,
                    'joinColumns' => [
                        [
                            'name' => 'idUsersChanger',
                            'onDelete' => 'SET NULL',
                            'referencedColumnName' => 'id',
                            'nullable' => true,
                        ],
                    ],
                ]);
            }
        }
    }
public function loadClassMetadata ( LoadClassMetadataEventArgs $ event ) { $ metadata = $ event -> getClassMetadata ( ) ; $ reflection = $ metadata -> getReflectionClass ( ) ; if ( null !== $ reflection && $ reflection -> implementsInterface ( 'Sulu\Component\Persistence\Model\UserBlameInterface' ) ) { if ( ! $ metadata -> hasAssociation ( self :: CREATOR_FIELD ) ) { $ metadata -> mapManyToOne ( [ 'fieldName' => self :: CREATOR_FIELD , 'targetEntity' => $ this -> userClass , 'joinColumns' => [ [ 'name' => 'idUsersCreator' , 'onDelete' => 'SET NULL' , 'referencedColumnName' => 'id' , 'nullable' => true , ] , ] , ] ) ; } if ( ! $ metadata -> hasAssociation ( self :: CHANGER_FIELD ) ) { $ metadata -> mapManyToOne ( [ 'fieldName' => self :: CHANGER_FIELD , 'targetEntity' => $ this -> userClass , 'joinColumns' => [ [ 'name' => 'idUsersChanger' , 'onDelete' => 'SET NULL' , 'referencedColumnName' => 'id' , 'nullable' => true , ] , ] , ] ) ; } } }
Map creator and changer fields to User objects.

@param LoadClassMetadataEventArgs $event
Map creator and changer fields to User objects .