我有一个我不明白的小问题。我有一些Symfony命令生成的Bundle项目,他们在web / bundle / mypersonalbundle中创建一个通用的bundle文件夹。好的,但是当我从composer.phar进行更新时,其中一个总是空的。只有一个!谢谢你的帮助!
$ php composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Removing doctrine/cache (v1.2.0)
- Installing doctrine/cache (v1.3.0)
Loading from cache
...
Installing assets using the hard copy option
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
Installing assets for OS\MyPersonalBundleBundle into web/bundles/mypersonalbundle # <--- ?
Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution
我没有更新FrameworkBundle和DistributionBundle,但为什么我的个人捆绑?
这是我的composer.json“require”配置:
"require" : {
"symfony/symfony" : "2.3.*",
"symfony/swiftmailer-bundle" : "2.3.*",
"friendsofsymfony/user-bundle" : "~2.0@dev",
"doctrine/orm" : ">=2.2.3,<2.4-dev",
"symfony/assetic-bundle" : "2.3.*",
"incenteev/composer-parameter-handler" : "~2.0",
"twig/extensions" : "1.0.*",
"php" : ">=5.3.3",
"sensio/generator-bundle" : "2.3.*",
"symfony/monolog-bundle" : "2.3.*",
"sensio/framework-extra-bundle" : "2.3.*",
"doctrine/doctrine-bundle" : "1.2.*",
"sensio/distribution-bundle" : "2.3.*"
},
我的personalBundle已经像我在AppKernel.php中的其他捆绑包那样注册了:
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new FOS\UserBundle\FOSUserBundle(),
new My\PersonalBundleBundle\MyPersonalBundleBundle(),
new My\PersonalBundle2Bundle\MyPersonalBundle2Bundle(),
new My\PersonalBundle3Bundle\MyPersonalBundle3Bundle(),
);
答案 0 :(得分:3)
你有一个MyPersonalBundle。
在这个Bundle中,您有一个Resources目录。
在此目录中,您可以创建一个名为“public”的目录,然后将您的css,js,img文件放入其中。允许在公共目录中使用目录。
当您使用composer时,它将执行php app/console assets:install
命令。
此命令复制web / bundle / mypersonalbundle中公共目录的内容。
建议:使用composer.json中的额外选项创建符号链接,而不是使用硬拷贝。
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "symlink"
}
,命令为php app/console assets:install --symlink