我有一个不明白的小问题。我有一些由Symfony命令生成的捆绑包项目,他们在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 SymfonyBundleFrameworkBundle into web/bundles/framework
Installing assets for OSMyPersonalBundleBundle into web/bundles/mypersonalbundle # <--- ?
Installing assets for SensioBundleDistributionBundle into web/bundles/sensiodistribution
我可以更新 FrameworkBundle 和 DistributionBundle,但为什么是我的个人捆绑包?
这是我的作曲家.json"需要"配置:
"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.*"
},
我的个人捆绑包注册得很好,就像我在 AppKernel 中的其他捆绑包一样.php :
$bundles = array(
new SymfonyBundleFrameworkBundleFrameworkBundle(),
new SymfonyBundleSecurityBundleSecurityBundle(),
new SymfonyBundleTwigBundleTwigBundle(),
new SymfonyBundleMonologBundleMonologBundle(),
new SymfonyBundleSwiftmailerBundleSwiftmailerBundle(),
new SymfonyBundleAsseticBundleAsseticBundle(),
new DoctrineBundleDoctrineBundleDoctrineBundle(),
new SensioBundleFrameworkExtraBundleSensioFrameworkExtraBundle(),
new FOSUserBundleFOSUserBundle(),
new MyPersonalBundleBundleMyPersonalBundleBundle(),
new MyPersonalBundle2BundleMyPersonalBundle2Bundle(),
new MyPersonalBundle3BundleMyPersonalBundle3Bundle(),
);
你有一个 MyPersonalBundle。在此捆绑包中,您有一个资源目录。在这个目录中,你可以创建一个名为"public"的目录,然后将你的css,js,img文件放在其中。允许公共目录中的目录。当您使用作曲家时,它将执行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