Skip to content

Commit

Permalink
fixed sf version compare
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalkaoz committed Jun 19, 2012
1 parent 2825a61 commit 547628d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DependencyInjection/LiipImagineExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function load(array $configs, ContainerBuilder $container)

$container->setParameter('liip_imagine.controller_action', $config['controller_action']);

if (version_compare(LiipImagineBundle::getSymfonyVersion(Kernel::VERSION), '2.1.0', '<')) {
if ('2' == Kernel::MAJOR_VERSION && '0' == Kernel::MINOR_VERSION) {
$container->removeDefinition('liip_imagine.cache.clearer');
}
}
Expand Down
14 changes: 0 additions & 14 deletions LiipImagineBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,4 @@ public function build(ContainerBuilder $container)

$container->addCompilerPass(new LoadersCompilerPass());
}

/**
* Returns a cleaned version number
*
* @param string $version
* @return string
*/
public static function getSymfonyVersion($version)
{
return implode('.', array_slice(array_map(function($val)
{
return (int)$val;
}, explode('.', $version)), 0, 3));
}
}
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/LiipImagineExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function testCacheClearerRegistration()
{
$this->createFullConfiguration();

if (version_compare(LiipImagineBundle::getSymfonyVersion(Kernel::VERSION), '2.1.0', '<')) {
if ('2' == Kernel::MAJOR_VERSION && '0' == Kernel::MINOR_VERSION) {
$this->assertFalse($this->containerBuilder->hasDefinition('liip_imagine.cache.clearer'));
} else {
$this->assertTrue($this->containerBuilder->hasDefinition('liip_imagine.cache.clearer'));
Expand Down

4 comments on commit 547628d

@renevall
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is causing me error. Did you update the file where you declared those constants?

Fatal error: Undefined class constant 'MAJOR_VERSION' in /var/www/regalon/vendor/bundles/Liip/ImagineBundle/DependencyInjection/LiipImagineExtension.php on line 48

@lsmith77
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ResidentBio: you need at least 2.0.14 for this to work.

@renevall
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah just realized that. Thank you. We were working with Symfony 2.0.12

@lsmith77
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an update to 2.0.14 should be quite painless.

Please sign in to comment.