我看到http://symfony.com/doc/current/bundles/SensioGeneratorBundle/index.html繼承Sensio公司發生器管束
如果我在app /資源/ SensioGeneratorBundle /骨架我重寫模板/ ...
它的確定與樹枝標籤
{% extends 'skeleton/bundle/Bundle.php.twig' %}
和重寫塊
但如果我創建我自己的GeneratorBundle「繼承」SensioGeneratorBundle與
public function getParent() { return 'SensioGeneratorBundle'; }
,把我覆蓋骨架模板BUNDLE_PATH /資源/ SensioGeneratorBundle /像文檔骨架說這一點兒也不工作
我需要創建自己的套件用於覆蓋命令
我會混合兩者嗎? 「繼承」捆綁覆蓋命令和覆蓋模板在應用程序/資源
或我可以說是「繼承」捆綁包,並重載包中的命令和骨架模板?
的答覆
THX編輯
我開一個問題SensioGeneratorBundle:
https://github.com/sensiolabs/SensioGeneratorBundle/issues/233
的GeneratorBundleCommand不把我的繼承束在方法getGenerator參數()
THX答覆 是我做的!我的目錄是: src/Vendor/Bundle/GeneratorBundle/Resources/skeleton/... 但是不起作用! 例如: ' {#SRC /供應商/捆綁/ GeneratorBundle /資源/骨架/束/ Bundle.php.twig#} {% '延伸骨架/束/ Bundle.php.twig' %} {%block use_statements%} 使用Symfony \ Component \ HttpKernel作爲HttpKernel; {%末端嵌段use_statements%} {%塊class_definition%} 類{{束}}延伸HttpKernel \捆綁\捆綁 {%末端嵌段class_definition%} ' – L0rD59
當起初試圖繼承通過的getParent()的symfony找到應用程序中的資源(Resource/ChildBundleName),接下來是在子包上,接下來是在父包上。試試把你的資源放到app/GeneratorBundle/... – zulus
如果我把我的資源放到app/Resources/SensioGeneratorBundle中,就像我在我的第一條評論中說的那樣,可能我會混合使用繼承bundle來覆蓋命令並覆蓋骨架在應用程序/資源,但我想重寫包中的骨架太 – L0rD59