|
@@ -12,6 +12,7 @@
|
|
|
namespace Symfony\Bundle\AsseticBundle\Factory;
|
|
|
|
|
|
use Assetic\Factory\AssetFactory as BaseAssetFactory;
|
|
|
+use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
|
use Symfony\Component\HttpKernel\KernelInterface;
|
|
|
|
|
|
/**
|
|
@@ -21,11 +22,21 @@ use Symfony\Component\HttpKernel\KernelInterface;
|
|
|
*/
|
|
|
class AssetFactory extends BaseAssetFactory
|
|
|
{
|
|
|
- protected $kernel;
|
|
|
+ private $kernel;
|
|
|
+ private $container;
|
|
|
|
|
|
- public function __construct(KernelInterface $kernel, $baseDir, $debug = false)
|
|
|
+ /**
|
|
|
+ * Constructor.
|
|
|
+ *
|
|
|
+ * @param KernelInterface $kernel The kernel is used to parse bundle notation
|
|
|
+ * @param ContainerInterface $container The container is used to load the managers lazily, thus avoiding a circular dependency
|
|
|
+ * @param string $baseDir The base directory for relative inputs
|
|
|
+ * @param Boolean $debug The current debug mode
|
|
|
+ */
|
|
|
+ public function __construct(KernelInterface $kernel, ContainerInterface $container, $baseDir, $debug = false)
|
|
|
{
|
|
|
$this->kernel = $kernel;
|
|
|
+ $this->container = $container;
|
|
|
|
|
|
parent::__construct($baseDir, $debug);
|
|
|
}
|
|
@@ -51,4 +62,22 @@ class AssetFactory extends BaseAssetFactory
|
|
|
|
|
|
return parent::parseInput($input);
|
|
|
}
|
|
|
+
|
|
|
+ protected function createAssetReference($name)
|
|
|
+ {
|
|
|
+ if (!$this->getAssetManager()) {
|
|
|
+ $this->setAssetManager($this->container->get('assetic.asset_manager'));
|
|
|
+ }
|
|
|
+
|
|
|
+ return parent::createAssetReference($name);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected function getFilter($name)
|
|
|
+ {
|
|
|
+ if (!$this->getFilterManager()) {
|
|
|
+ $this->setFilterManager($this->container->get('assetic.filter_manager'));
|
|
|
+ }
|
|
|
+
|
|
|
+ return parent::getFilter($name);
|
|
|
+ }
|
|
|
}
|