Skip to content
Permalink
Browse files

Drop no more required tags

  • Loading branch information
mabar committed Nov 29, 2019
1 parent edefd1f commit 97b9927d9245ccd5b613ec7cba331e45e39f963b
Showing with 9 additions and 38 deletions.
  1. +9 −38 src/DI/Atlantic18BehaviorExtension.php
@@ -24,8 +24,6 @@
class Atlantic18BehaviorExtension extends CompilerExtension
{

public const TAG_NETTRINE_SUBSCRIBER = 'nettrine.subscriber';

public function getConfigSchema(): Schema
{
return Expect::structure([
@@ -55,62 +53,42 @@ public function loadConfiguration(): void
$builder = $this->getContainerBuilder();
$config = $this->config;

// Loggable ==================================================

if ($config->loggable) {
$builder->addDefinition($this->prefix('loggable'))
->setFactory(LoggableListener::class)
->addSetup('setAnnotationReader', ['@' . Reader::class])
->addTag(self::TAG_NETTRINE_SUBSCRIBER);
->addSetup('setAnnotationReader', ['@' . Reader::class]);
}

// Sluggable =================================================

if ($config->sluggable) {
$builder->addDefinition($this->prefix('sluggable'))
->setFactory(SluggableListener::class)
->addSetup('setAnnotationReader', ['@' . Reader::class])
->addTag(self::TAG_NETTRINE_SUBSCRIBER);
->addSetup('setAnnotationReader', ['@' . Reader::class]);
}

// SoftDeleteable ============================================

if ($config->softDeleteable) {
$builder->addDefinition($this->prefix('softDeleteable'))
->setFactory(SoftDeleteableListener::class)
->addSetup('setAnnotationReader', ['@' . Reader::class])
->addTag(self::TAG_NETTRINE_SUBSCRIBER);
->addSetup('setAnnotationReader', ['@' . Reader::class]);
}

// Treeable ==================================================

if ($config->treeable) {
$builder->addDefinition($this->prefix('treeable'))
->setFactory(TreeListener::class)
->addSetup('setAnnotationReader', ['@' . Reader::class])
->addTag(self::TAG_NETTRINE_SUBSCRIBER);
->addSetup('setAnnotationReader', ['@' . Reader::class]);
}

// Blameable =================================================

if ($config->blameable) {
$builder->addDefinition($this->prefix('blameable'))
->setFactory(BlameableListener::class)
->addSetup('setAnnotationReader', ['@' . Reader::class])
->addTag(self::TAG_NETTRINE_SUBSCRIBER);
->addSetup('setAnnotationReader', ['@' . Reader::class]);
}

// Timestampable =============================================

if ($config->timestampable) {
$builder->addDefinition($this->prefix('timestampable'))
->setFactory(TimestampableListener::class)
->addSetup('setAnnotationReader', ['@' . Reader::class])
->addTag(self::TAG_NETTRINE_SUBSCRIBER);
->addSetup('setAnnotationReader', ['@' . Reader::class]);
}

// Translatable ==============================================

if ($config->translatable !== false) {
$translatableConfig = $config->translatable;
$builder->addDefinition($this->prefix('translatable'))
@@ -120,27 +98,20 @@ public function loadConfiguration(): void
->addSetup('setTranslatableLocale', [$translatableConfig->translatable])
->addSetup('setPersistDefaultLocaleTranslation', [$translatableConfig->translationFallback])
->addSetup('setTranslationFallback', [$translatableConfig->persistDefaultTranslation])
->addSetup('setSkipOnLoad', [$translatableConfig->skipOnLoad])
->addTag(self::TAG_NETTRINE_SUBSCRIBER);
->addSetup('setSkipOnLoad', [$translatableConfig->skipOnLoad]);
}

// Sortable ==================================================

if ($config->sortable) {
$builder->addDefinition($this->prefix('sortable'))
->setFactory(SortableListener::class)
->addSetup('setAnnotationReader', ['@' . Reader::class])
->addTag(self::TAG_NETTRINE_SUBSCRIBER);
->addSetup('setAnnotationReader', ['@' . Reader::class]);
}

// IpTraceable ===============================================

if ($config->ipTraceable !== false) {
$builder->addDefinition($this->prefix('ipTraceable'))
->setFactory(IpTraceableListener::class)
->addSetup('setAnnotationReader', ['@' . Reader::class])
->addSetup('setIpValue', $config->ipTraceable->ipValue)
->addTag(self::TAG_NETTRINE_SUBSCRIBER);
->addSetup('setIpValue', $config->ipTraceable->ipValue);
}
}

0 comments on commit 97b9927

Please sign in to comment.
You can’t perform that action at this time.