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

        if (null !== $reflection && $reflection->implementsInterface('Sulu\Component\Persistence\Model\TimestampableInterface')) {
            if (!$metadata->hasField(self::CREATED_FIELD)) {
                $metadata->mapField([
                    'fieldName' => self::CREATED_FIELD,
                    'type' => 'datetime',
                    'notnull' => true,
                ]);
            }

            if (!$metadata->hasField(self::CHANGED_FIELD)) {
                $metadata->mapField([
                    'fieldName' => self::CHANGED_FIELD,
                    'type' => 'datetime',
                    'notnull' => true,
                ]);
            }
        }
    }
public function loadClassMetadata(LoadClassMetadataEventArgs $event)
    {
        $metadata = $event->getClassMetadata();
        $reflection = $metadata->getReflectionClass();

        if (null !== $reflection && $reflection->implementsInterface('Sulu\Component\Persistence\Model\TimestampableInterface')) {
            if (!$metadata->hasField(self::CREATED_FIELD)) {
                $metadata->mapField([
                    'fieldName' => self::CREATED_FIELD,
                    'type' => 'datetime',
                    'notnull' => true,
                ]);
            }

            if (!$metadata->hasField(self::CHANGED_FIELD)) {
                $metadata->mapField([
                    'fieldName' => self::CHANGED_FIELD,
                    'type' => 'datetime',
                    'notnull' => true,
                ]);
            }
        }
    }
public function loadClassMetadata ( LoadClassMetadataEventArgs $ event ) { $ metadata = $ event -> getClassMetadata ( ) ; $ reflection = $ metadata -> getReflectionClass ( ) ; if ( null !== $ reflection && $ reflection -> implementsInterface ( 'Sulu\Component\Persistence\Model\TimestampableInterface' ) ) { if ( ! $ metadata -> hasField ( self :: CREATED_FIELD ) ) { $ metadata -> mapField ( [ 'fieldName' => self :: CREATED_FIELD , 'type' => 'datetime' , 'notnull' => true , ] ) ; } if ( ! $ metadata -> hasField ( self :: CHANGED_FIELD ) ) { $ metadata -> mapField ( [ 'fieldName' => self :: CHANGED_FIELD , 'type' => 'datetime' , 'notnull' => true , ] ) ; } } }
Load the class data, mapping the created and changed fields
to datetime fields.

@param LoadClassMetadataEventArgs $event
Load the class data mapping the created and changed fields to datetime fields .