Skip to content

Commit

Permalink
Symfony 4 compatible.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilov committed Aug 30, 2018
1 parent ed04448 commit 03d6881
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
6 changes: 3 additions & 3 deletions DependencyInjection/GlavwebUploaderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Glavweb\UploaderBundle\DependencyInjection;

use Liip\ImagineBundle\Templating\Helper\ImagineHelper;
use Liip\ImagineBundle\Templating\Helper\FilterHelper;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Reference;
Expand Down Expand Up @@ -41,9 +41,9 @@ public function load(array $configs, ContainerBuilder $container)

$container->setParameter('glavweb_uploader.config', $config);

if (class_exists(ImagineHelper::class)) {
if (class_exists(FilterHelper::class)) {
$container->getDefinition('glavweb_uploader.util.media_structure')->addMethodCall('setImagineHelper', [
new Reference('liip_imagine.templating.helper')
new Reference('liip_imagine.templating.filter_helper')
]);
}
}
Expand Down
1 change: 0 additions & 1 deletion Provider/ImageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Glavweb\UploaderBundle\Provider;

use Glavweb\UploaderBundle\File\FileInterface;
use Glavweb\UploaderBundle\Helper\MediaHelper;
use Glavweb\UploaderBundle\Model\MediaInterface;

/**
Expand Down
20 changes: 10 additions & 10 deletions Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<services>
<service id="glavweb_uploader.error_handler.standard" class="Glavweb\UploaderBundle\ErrorHandler\StandardErrorHandler" />

<service id="glavweb_uploader.uploader_manager" class="Glavweb\UploaderBundle\Manager\UploaderManager">
<service id="glavweb_uploader.uploader_manager" class="Glavweb\UploaderBundle\Manager\UploaderManager" public="true">
<argument>%glavweb_uploader.config%</argument>
<call method="setContainer">
<argument type="service" id="service_container" />
Expand All @@ -23,11 +23,11 @@
</call>
</service>

<service id="glavweb_uploader.model_manager.orm" class="Glavweb\UploaderBundle\Model\OrmModelManager">
<service id="glavweb_uploader.model_manager.orm" class="Glavweb\UploaderBundle\Model\OrmModelManager" public="true">
<argument type="service" id="doctrine" />
</service>

<service id="glavweb_uploader.storage.filesystem" class="Glavweb\UploaderBundle\Storage\FilesystemStorage">
<service id="glavweb_uploader.storage.filesystem" class="Glavweb\UploaderBundle\Storage\FilesystemStorage" public="true">
<argument>%kernel.cache_dir%</argument>
</service>

Expand All @@ -36,7 +36,7 @@
<tag name="doctrine.orm.entity_listener" />
</service>

<service id="glavweb_uploader.media_helper" class="Glavweb\UploaderBundle\Helper\MediaHelper">
<service id="glavweb_uploader.media_helper" class="Glavweb\UploaderBundle\Helper\MediaHelper" public="true">
<argument>%glavweb_uploader.config%</argument>
<argument type="service" id="request_stack" />
</service>
Expand All @@ -49,18 +49,18 @@
</service>

<!-- providers -->
<service id="glavweb_uploader.provider.file" class="%glavweb_uploader.provider.file.class%">
<service id="glavweb_uploader.provider.file" class="%glavweb_uploader.provider.file.class%" public="true">
<argument type="service" id="glavweb_uploader.media_helper" />
</service>

<service id="glavweb_uploader.provider.image" class="%glavweb_uploader.provider.image.class%">
<service id="glavweb_uploader.provider.image" class="%glavweb_uploader.provider.image.class%" public="true">
<argument type="service" id="glavweb_uploader.media_helper" />
</service>

<service id="glavweb_uploader.provider.youtube" class="%glavweb_uploader.provider.youtube.class%" />
<service id="glavweb_uploader.provider.youtube" class="%glavweb_uploader.provider.youtube.class%" public="true" />

<!-- namer -->
<service id="glavweb_uploader.namer.uniqid" class="%glavweb_uploader.namer.uniqid.class%" />
<service id="glavweb_uploader.namer.uniqid" class="%glavweb_uploader.namer.uniqid.class%" public="true" />

<!-- validators -->
<service id="glavweb_uploader.validation_listener.max_size" class="Glavweb\UploaderBundle\EventListener\MaxSizeValidationListener">
Expand All @@ -75,11 +75,11 @@
<tag name="kernel.event_listener" event="glavweb_uploader.validation" method="onValidate" />
</service>

<service id="glavweb_uploader.data_driver.annotation" class="Glavweb\UploaderBundle\Driver\AnnotationDriver">
<service id="glavweb_uploader.data_driver.annotation" class="Glavweb\UploaderBundle\Driver\AnnotationDriver" public="true">
<argument type="service" id="annotation_reader" />
</service>

<service id="glavweb_uploader.util.media_structure" class="Glavweb\UploaderBundle\Util\MediaStructure">
<service id="glavweb_uploader.util.media_structure" class="Glavweb\UploaderBundle\Util\MediaStructure" public="true">
<argument type="service" id="glavweb_uploader.media_helper" />
</service>

Expand Down
10 changes: 5 additions & 5 deletions Util/MediaStructure.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Glavweb\UploaderBundle\Exception\Exception;
use Glavweb\UploaderBundle\Helper\MediaHelper;
use Glavweb\UploaderBundle\Model\MediaInterface;
use Liip\ImagineBundle\Templating\Helper\ImagineHelper;
use Liip\ImagineBundle\Templating\Helper\FilterHelper;

/**
* Class MediaStructure
Expand All @@ -31,7 +31,7 @@ class MediaStructure
private $mediaHelper;

/**
* @var ImagineHelper
* @var FilterHelper
*/
private $imagineHelper;

Expand All @@ -46,7 +46,7 @@ public function __construct(MediaHelper $mediaHelper)
}

/**
* @param ImagineHelper $imagineHelper
* @param FilterHelper $imagineHelper
*/
public function setImagineHelper($imagineHelper)
{
Expand Down Expand Up @@ -84,8 +84,8 @@ public function getMediaStructure(MediaInterface $media, $thumbnailFilter = null
$thumbnailPath = null;
if ($media->getThumbnailPath()) {
if ($thumbnailFilter) {
if (!$this->imagineHelper instanceof ImagineHelper) {
throw new Exception('ImagineHelper is not defined. You need use Liip\ImagineBundle.');
if (!$this->imagineHelper instanceof FilterHelper) {
throw new Exception('FilterHelper is not defined. You need use Liip\ImagineBundle.');
}

$thumbnailPath = $this->mediaHelper->getThumbnailPath($media, false);
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
}
],
"require": {
"symfony/http-foundation": "~2.3|~3.0",
"symfony/form": "~2.3|~3.0"
"symfony/http-foundation": "^2.7|^3.0|^4.0",
"symfony/form": "^2.7|^3.0|^4.0"
},
"autoload": {
"psr-4": { "Glavweb\\UploaderBundle\\": "" }
Expand Down

0 comments on commit 03d6881

Please sign in to comment.