0
我一直在尋找一個答案,但我找不到它。資產過濾器和實體經理
如何使用assetic從數據庫加載數據?
此過濾器
<?php
namespace project\bundle\mybundle\Assetic;
use Assetic\Asset\AssetInterface;
use Assetic\Filter\FilterInterface;
use Symfony\Component\DependencyInjection\Container;
use Doctrine\ORM\EntityManager;
class CssFilter implements FilterInterface
{
protected $entityManager;
protected $container;
public function __construct(EntityManager $entityManager, Container $container)
{
$this->entityManager = $entityManager;
$this->container = $container;
}
public function filterLoad(AssetInterface $asset)
{
}
public function filterDump(AssetInterface $asset)
{
$content = $asset->getContent();
$themeId = 3;
$theme = $this->entityManager->getRepository('projectBundle:Theme')->find($themeId);
$css = $theme->getCss();
$asset->setContent($css);
}
}
我能夠從數據庫中加載的CSS但僅限於一次,每次我重裝我的CSS一次使用預編譯的版本。
我怎樣才能讓資產在每個頁面加載時使用轉儲或加載功能?
我一直在尋找我無法找到任何答案
事實上,我正在尋找一個解決方案,用戶資產過濾器和entitymanager從數據庫動態加載數據,如果可能的話,會很好。 我從資產的薩斯過濾器的代碼紅色,可見他做幾乎相同和finnaly他做一筆資產:轉儲......對我來說這不是一個解決方案。我將無法使用資產形式我的問題,我認爲 但ty爲您的幫助 – user3228337