Skip to content

Commit

Permalink
Add copy cloned uploadables event subscriber.
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Nikolaev committed Mar 12, 2020
1 parent f20b488 commit 77b474d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ $ /usr/bin/env php bin/console darvin:utils:translations:title-case <pathname>
7.3.3: Disable alias services compiler pass.

7.3.4: Add antispam form theme.

7.3.5: Add copy cloned uploadables event subscriber.
1 change: 1 addition & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function getConfigTreeBuilder(): TreeBuilder
$root
->children()
->append($this->buildOverrideNode())
->scalarNode('tmp_dir')->defaultValue(sprintf('%s/darvin/utils', sys_get_temp_dir()))->cannotBeEmpty()->end()
->scalarNode('yandex_translate_api_key')->defaultNull()->end()
->arrayNode('response')->addDefaultsIfNotSet()
->children()
Expand Down
4 changes: 3 additions & 1 deletion DependencyInjection/DarvinUtilsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class DarvinUtilsExtension extends Extension implements PrependExtensionInterfac
private const BUNDLE_DOCTRINE_EXTENSIONS = 'StofDoctrineExtensionsBundle';
private const BUNDLE_SECURITY = 'SecurityBundle';
private const BUNDLE_TWIG = 'TwigBundle';
private const BUNDLE_UPLOADER = 'VichUploaderBundle';

private const CLASS_FILESYSTEM = 'Symfony\Component\Filesystem\Filesystem';
private const CLASS_FORM = 'Symfony\Component\Form\Form';
Expand Down Expand Up @@ -66,7 +67,8 @@ public function load(array $configs, ContainerBuilder $container): void
'service',
'transliteratable/common',

'cloner' => ['class' => self::CLASS_PROPERTY_ACCESS],
'cloner/common' => ['class' => self::CLASS_PROPERTY_ACCESS],
'cloner/uploadable' => ['class' => [self::CLASS_PROPERTY_ACCESS, self::CLASS_FILESYSTEM], 'bundle' => self::BUNDLE_UPLOADER],

'custom_object' => ['class' => self::CLASS_PROPERTY_ACCESS],

Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions Resources/config/services/cloner/uploadable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
parameters:
darvin_utils.cloner.uploadable.tmp_dir: '%darvin_utils.tmp_dir%/cloner/uploadable'

darvin_utils.cloner.uploadable.copy_event_subscriber.class: Darvin\Utils\EventListener\Cloner\CopyUploadablesSubscriber

services:
darvin_utils.cloner.uploadable.copy_event_subscriber:
class: '%darvin_utils.cloner.uploadable.copy_event_subscriber.class%'
arguments:
- '@filesystem'
- '@vich_uploader.metadata_reader'
- '@property_accessor'
- '@vich_uploader.storage'
- '%darvin_utils.cloner.uploadable.tmp_dir%'
tags:
- { name: kernel.event_subscriber }

0 comments on commit 77b474d

Please sign in to comment.