5. 服务容器及Symfony依赖注入组件

龶龶龳龱龯龬龩龧龤龠龝龙龘龗龔龓龐龎龊龤drupal8齳齲齱齮齪齩龬齦齥齣齟齜龓龙齚齗齓龬齳齲龓齒齑齍齊齉Symfony鼸鼵鼱鼭鼬鼩龤drupal8齳齲齪鼨鼥龓鼢鼟齪龗鼨鼛龗

鼚鼖鼕鼓鼢鼐鼎鼍鼋齒齑齍齊鼊鼆鼋鼸鼵鼱鼭鼊龯鼂齪鼀黿黼黹黵龓黲黯黬黩黥黣龓黡龤點黚黖黔黒黑龓黎黋黇黅齩黎黃

黀龝鼸鼵鼱鼭麿麼齩龬鼍麺齪齱齮龔鼸麷麴麳齩龬鼍麺齪麰麬龓麪麧麣龤鼸鼵龓麠龯龬鼸鼵齪鼍麺麟麝麙麘鼍麺齪麖齣鼨龐麕麒麏麌麊龓麪麧麣龤鼱鼭麉龓麈麅麁麣龤鼋鼸鼵鼱鼭鼊龯龬鼀齪麁鹽龓鹹龬鹸鹵齪鹳鹰黃鹭鹫齩龬黚鹩鹧鹣鹢鹠鹟齊鼍麺Validator龓鼐龐鹠鹟鹘鹰鹗鼩鼆鹔鹒鹟鹏鹌鼆鹘鹉鹏鹌鹅鹅龓鹄龙鹀鹔鸼黯鸻鸸黀鹠鹟鸷鸶龓鸴齩鸰鹠鹟鸬齩龬鸩鸨齪鼍麺鸧鸣龓鹭鹫鹘鹰鹗鼩鹣鹢鹠鹟鸬mailer鼍麺鸜鸛龓鸙鸕Validator鼍麺齪set鸷鸶鸎addValidator鸷鸶鸊mailer鸎黲鸈鹠鹟齊鼍麺麟麝麙Validator齪麖齣鸆黋龓鸃Validator鼍麺鼨麣鼐龐麌麊鸼鼓齪鹠鹟齊麁鸜鸛鷿鷾麉龓龯麣龤鸊鼸鼵鼱鼭麙鷽鷺麖齣鸆黋龓龙麣龤鼸鼵鼱鼭齪鷶鷺麉龓龤鸼龤鼚黥黣麿黲黯龯麣龤齩鷲鷱鼩鷯鷬鷫鹢黒黑鷪

鸃齩龬鷩鷥齳齲鼨鷢鷟鷛鷛鼖鼖齪黩麊鼍麺龓鷚鷘齩鷔齪龓鷓鷒鸊龯鷏黩麊鼍麺齲齲麟麝麙齩龬鷋鷊鼍麺鼨龓龔麊齪麏鷆鸙鸕鼍鷂齪齟齜鹩鷀鶼鶹麊鶷鼐龓龯鼂龤鸼龤鼚黥鶶鸷麕鶳鶯鸃drupal8鼨鷟鶫鶩鼖龬黩麊鼍麺龓龙鷒麣鶦麟麝麙麉齩龬鷋鷊鼍麺鼨龓龯龬鷋鷊鼍麺麣鶣鶡齍齊龓龯鷏黩麊鼍麺鶝鷬鶛鶘鶔鼢鶑鶍麣鶣鶡齒齑鶌麣鶈鷬鶛鶘鶇鷾齳齲鼨鶅黩麊齪鶁鶀鶦齩鵼鵻鵺鵹齮龓鸃window鼨麣鶣鶡齒齑龓鹭鹫鸃win7鼨龤鵱鵮鷓齪鹘鵭-鵥鵤-齒齑鵡鷂麊鶁鶀-齒齑龓麣鵠鶼麉齳齲鵞鷟齪齒齑鵜龓鵞龐龯龬齍齊鵚鼐龐鶣鶡齒齑齍齊鶯

麙龯鸆鵖鷂鵓鵐鵎麉鼋齒齑齍齊鼊鼆鼋鼸鼵鼱鼭鼊龓點黚黖黔黒黑龓鵍鷟鼸鼵鼱鼭龯龬鷯鷬鷫鹢龓鵌鵻麣鵉黵麉齒齑齍齊龯鼂齪鵇鵄龓鸃drupal8鼨鷩鷺鵃鶁鶀鵀龤龐齒齑鼍麺齪鸷鹢麟麝鸃齍齊鼨龓齲鷬麉齩黎鴾鴽黎鴼齪鴺鴹鴸鴵鷟鶫鶩鼖龬齒齑龓黎黋鹸鹵鴲鴲齒齑齍齊鷪

齩龬齍齊鶌鷋鷊鼍麺鵜鸆黋麟麝齪鼍麺鶌鵚鶣齒齑龓黋鴮鴭鴫黒鴨鴧鴤鸷麕黎鴣鷟麏鴢鴟龝鼍麺鵜鷟鴛鷩鸰龓齩鸰龤麳鷺黯鹳鴘鴔齪鼍麺龓鵌鵻鼱鼭麙齍齊鸆黋龓麴麳齩鸰龤齍齊鴓鴐鼍麺齪鴌鴉鴈鴐鹀鴄黯鹳鴘鶼麁齪鼍麺鷪鸃drupal8鼨鷩鷺鵃龤鵻鴁龓齍齊鼍麺鴓鴐鴌鴉鴈鴐鸃鴀龔麏鳼黯鹳鴘鼎鳺鳹齣鼎齉鳸鳵鳳鳲鷪

黎黋麁鴲齩鴲drupal鹫黀黯鸻齍齊齪黃

齍齊齪鳱鸛龤鸃 \core\lib\Drupal\Core\DrupalKernel 鼨龓龙鴟鼛龝drupal鳟鳝鸰龓鳙點黚麣鼐龐鴲鶼龓龯龬鸰齪龩龔鷿鷾麣龤鳘鳕齍齊龓鼐鳒齍齊鼛龗龔鷪

鸃黯鳎鳊鹌鸕鶁鼨黃

鵍龤鳱鸛齩龬鳉鳅齍齊龓龯龬齍齊鳂鲾麉 鴈鴐鲺 鼍麺鼆鲹麝鼍麺鹅鲸麘齪齒齑龓龐鲶鵻鲵齍齊鳱鸛鶹麊龓鲱麊龯鼂齪鷯鷬龤黥鶶麅鳒

鵌鵻龤鲯鳕Symfony齍齊龓龯龬龤齍齊鳱鸛齪龩龔鷿鷾龓鳱鸛鵻鸊齍齊鴌鴉鴈鴐鳅鶼龓鲫麟麝麙鲹麝鼨龓黎鲩鲦鲥鸊鵼鲣鳙鲹麝鲠鷀鴌鴉鴈鴐龓鲝鲛麉鷩鲚鷿鷾

鶅鵻龤麊鲖鲒鷔鳱鸛齪齍齊鴌鴉鴈鴐鳘鳕齩龬鶅鲐鶹麊齪drupal齍齊龓龯龬齍齊鵚鶣齱齮麏齍齊Drupal 8 run-time Container 龓龙龤鲏鸕黥鴘齪Symfony齍齊龓鲎鲍麉齩鷏鲊鼎龓鲫鲇鷘麉齩鷏鳊鹌鳺鳹齱齮鲃鲀

龐鱽麣龤齍齊鳱鸛齪鱻鱷鷔鱴龓鲖鲒鷔龤齍齊齪麘鱲齣鳱鸛龓龙鶹麊麉Symfony鼸鼵鼱鼭鼬鼩鶌鲸麘龤鸜鷶鶹麊龓drupal齪 ContainerBuilder 鱯鱮麉Symfony齪 ContainerBuilder 鸰龓黡龯鷏鱭鱬黃鱨鱤鷛齒齑齟齜鹩鵡鱢鴈點龝鱡龱鱟鸼鱤鷛@=鸷鹢齪鱙鱗鱟鱕鱔鱑麊鱎鱋鱟龝齒齑鷯鱉 _serviceId 麖齣鱟鱤鷛鰽鵇齍齊麏鶹麊 set 鸷鸶鼱鼭麳鷺齒齑鱟鰺麈 __sleep 鸷鸶鱟鹸鳒 Drupal\Core\DependencyInjection\ContainerBuilder 鵜龓鰵龯鷏鸼鼓麳龤鸜鷶鰳齍Symfony齍齊龓龠鰯鷓鷒鸃drupal8鸆黋鴌鴉齒齑鴢龤鰳齍Symfony齒齑鴌鴉齪龓龯龬鸕鶁鴢龤鷿鷾鲚鶅鷩龓鶅鰬鰪齪鸕鶁龓鵤黇麉龙鵻黲鸈鴛鷔麣鼚齍鰩鵤黇麉龓黎黋鷓鷒麣麁鴲鴲Symfony齍齊齪鳱鸛鷪

鵍鰥鰥齒齑齍齊鼨鼍麺齪鴌鴉鴈鴐龓鰡鰡鸃php鼨龔黯鹳鴘齩龬鼍麺鲫鰜龙鼐麊龤鰙麧齩龬鸕鶁鶳麿

鵖鼐龐鸙鸕齩龬鸰鴌鴉鵼鲣黯鹳鴘齩龬鼍麺龓鴢鼐龐麌麊鷿鰖鸷鸶鵉黵齩龬鼍麺鱟鵌鵻龔鼐麊龓鼐鼎鰔鴀龔鸙鸕鸰鰒set鸎add龯鼂齪鸷鸶龝鼍麺鷯鱉齩鷏鰎龔齪麖齣龓鴢鼐鼎龤鸃鲯鰌鰉鴈鸆黋鰈鰅齩鷏鱢鴈鱟齍齊鸆黋鷟鼚鼖龬鼍麺龓鹫鵄鵀鷶鷺黯鹳鴘鵻鰂麟麝鸃齍齊鸆黋龓麪麧鼚鸼鯾龊齣鼎龓鵞龐鲸麘龤麟麝鼍麺鯻鯸鯶鯲龓鸃鲠鷀齪麏鷆鳼黯鹳鴘鱟鷟鷏鼍麺黯鸃龘鯱鷩黬黩鳳鳲鳸鳵龓鼍龊龯鼂齪鼍麺鸃鲠鷀麏鴢鸼黯鹳鴘龓黒龤鸃鯭鯪鶹麊麏鳼黯鹳鴘龓鲠鷀麏鯩麙齪黡龤齩龬鳊鵤黒黑龓龯鼂齪鯨鶑鵚鶣鶡鯥龶麈鴼龓鸎鯤麈鴼鱟鷟鷏齒齑黡鳺鲶鯠齍齊鷽鷺鶹麊龓鸼鼍麳龓龠鰯齒齑鵚鷟鯝鷟鯙鷟龯鼂齪麖齣鱟鸃鸴鲩鲠鷀齒齑齪麏鷆鼐龐鯗鯔龤鼓齩龬鼍麺鰔龤龗鼕黯鹳鴘齩龬龓龠鰯鵚鷟鯓鯒鵡鸼鯓鯒齪麖齣鱟鷟鷏齒齑鶡鸰鰒齪鷿鷾鸎鯐鯍鯓鼓鯉鯈龓鹭鹫鱽鴣鯇鯃齪鹠鹟齊龓鮿鵌龤鸼鼓齪鹠鹟齊龓鹄鵀龤鼍黚鹩鹧鶡鹠鹟鶹麊龓麪麧鴀龔鼍龯鷏齒齑鷘齮鼬鮼齟鮸龓龠鰯麣鶼鸻麉齟鮷齪鮳鮯鱟鸃齍齊鳱鸛麏鼐鼎鴀龔鼍齒齑鼍麺齪鱢鴈麌齓鸎鮭鵤鯐鯍鮬齟鮷齪齒齑龓麣鷟麉齍齊鮨鮤齪鮳鮯鱟齒齑龤麳鷺鼱鼭齪鶳鰔龤齍齊鹀鴄黯鹳鴘齪鶳鴢鴀龔鷘齮齟鮸鱟齒齑鼐鼎鴀龔鱢鴈鴢鼐鼎鵡黲鸈齒齑鯓鯒鱢鴈龓麪麧鴀龔鴌鴉鱢鴈鶘鱔鱟鹫鵄齒齑鴀龔鰉鴈鲺鮠鴀龔麈鴼鰉鴈鲺鴣鼩鱟

齍齊鼍麺齪鴌鴉鴈鴐麣龤鮝鮛龯鷏鷽齍鷘齮齪龓鵍鷟龬鮚麺鼍鵻黋齪鼢鼟麣鮗鮔鷛鼖麉鷪

鸃Symfony鼨鷟龬鴟龝 Definition 齪鸰鳊鮐麉齒齑鼍麺鴌鴉鴈鴐龓龙鮎龊 \vendor\symfony\dependency-injection\Definition.php ,鳺鲶麉鶇鷾齒齑鼍麺鮆鴈鴐齪鵞鷟鸷鸶龓鱽鴣鰥麉鷩鷺鵃鼍麺鵀龤齍齊鹀鴄黯鹳鴘齪龓龙麣龤鼸鴐龯龬鼍麺麟麝齪鯶鯲麁黯鹳鴘齒齑龓鹫鵄龤麳鷺鼱鼭齪鼍麺龓Symfony鴟龝鮂鸛鮁龓龯鼂齪鼍麺鸃 Definition 鼍麺鸆黋魾鷟鼖魼齪鴈鴐龓鱨鷟齟齜鹩龓鵡鮂鸛鮁齟齜鷪

黎黋麁鴲齩鴲Symfony齍齊鳵鳊鹌黃

龙鷒鵀鮎龊 \vendor\symfony\dependency-injection 黎龓鳺鲶麉魸龬鲣魶麁魲魯齍齊黃

ContainerInterface 黃鲸麘齍齊鲣魶

IntrospectableContainerInterface 黃鷽鲛齍齊鲣魶龓鱯鱮鹀鲸麘鲣魶龓鵞魮鷽鲛麣龤鴲齒齑龤魫黑鲏鸬鴌鴉鮆鴈鴐黯鹳鴘鸛麉鼍麺龓鵓鲣魶鸃Symfony3.0鲫鼭鲸麘鲣魶

ResettableContainerInterface 黃鼐龗鱉齍齊鲣魶龓鱯鱮鹀鲸麘鲣魶龓鳺鲶龗鱉齍齊鲊鼎

TaggedContainerInterface 黃魝齟鮷齍齊鲣魶龓鱯鱮鹀鲸麘鲣魶龓龝齍齊魛麈齟鮷鲊鼎

Symfony鴌鴉麉齩龬鴾鴽齍齊黯鸻鸰黃

Container 黃龤齩龬黥黣齪齍齊龓鳺鲶麉鲣魶龔魙齪鲸麘鲊鼎鷪

鷓鷒鸃鳘鳕齍齊齪麏鷆魘魘鴀龔鷚鼖齪鲊鼎龓鵞龐Symfony鳺鲶麉齩龬 ContainerBuilder 龓龙鱯鱮鹀 Container 齍齊龓鹄鳺鲶麉魖魓齪鲊鼎麁麰麬鲯鳕齍齊龓鼐龐鴲鶡龤齩龬魐鮂麉齍齊鷿鰖齪齍齊龓鵞龐龙齪點黚龤 ContainerBuilder 齍齊鲯鳕龓龯龬齍齊鴢龤龩龔鶹麊齪齍齊鷪

鸃鱽鴣鳺麙齪鱻鱷鷔鱴鼨鲯鳕齍齊龓麣龤麊 ContainerBuilder 鲯鳕齩龬魎齍齊龓鵌鵻鸊齒齑鴌鴉鴈鴐鰺麈鷘鲎龓鰂鷯鱉魊鷲鱢鴈鼆鮂鸛鮁鶅鲐鳱鸛齩龬Symfony齍齊鷪

Symfony齍齊鲯鳕鸛鲊鵻龓鸊鳅鶼鶌 dumper )齍齊鴌鴉鴈鴐龓龯龬鳅鶼鷿鷾龤鸬 \core\lib\Drupal\Component\DependencyInjection\Dumper 鸜鸛齪龓鳅鶼麟麝麙鲹麝龓鲫麊龯龬鴌鴉鴈鴐鳕魄drupal齍齊龓鴢鶣鷾齱齮麏齍齊龓齳齲鵻鲵麣龤麊鵓齍齊麉龓鰥麙龯鸆鵖鼐鼎鷟齩龬魂鲥龓龝魁麧鸼鵼鲣鶹麊Symfony齍齊鶳麿鰔龔鳅鶼鰂鳕魄麪麧鬽鬹龓鬵鬴龤黃齣鼎鶯鬲鵍鳅鶼齪鴌鴉鴈鴐鶦齓鵤龓鲫鶹麊php鴈鼬鳱鹢龓鰂鴁drupal齍齊鴓鴐鹀鴄鴀龔鲎鲍麉鷛鼖鸼鰎龔齪鲊鼎龓龯鼂鼎鷩鷩鳺鳹鲃鲀鵡鲝鲛鳸鳵龓龯鸆鰥齩龬龧麳鹉黃鷛鼖鼨鬯鲶鷂鬬鵀鷟齩龬鬪鬩龓麣龤麠鵉鬨鶡齪鬧鲚鬦鷩龓鬢鬟鬧鼐鼎鼖齪鴀龔龓黒鸃鶅鲐鵉鬨齪鶹麊鱽鷛鼖鲊鼎鬞龤麊鸼麙齪龓龠鰯鶅鲐鵉鬨鷯鷬鴁鲏黩鴀龔鼍鬛鸛鬨鷘齮鬚鹔鴌鱔龓鸼黡龤鷱鼩鷯鷬鬙鬗龓鸃黵鬖鼨黲鸈鬙鬗鴢鲏黩鴲麙龓鰡鰡龤鸼龤龯鼂麿

Symfony容器和drupal容器的区别

Symfony齍齊鶹麊Definition鼍麺鶡齒齑齪鴌鴉鮆鴈鴐龓黒drupal齍齊鶹麊php鴈鼬龓鰡var_dump龯龬鴈鼬鬢鬟黎鴔鬔鳝麿鴲鶅鵻齪齍齊鬒鬐

Symfony齍齊鼨齪龐黎鲊鼎鸃drupal齍齊鼨鵀魾鷟麉黃

addCompilerPass getCompilerPassConfig getCompiler compile 黃鰺麈鮨鮤齊龓鵞龐drupal齍齊鬎鸶鰂鮨鮤龓龙龤齩龬黑鲏鮨鮤齪齍齊龓鯸龊鮨鮤黎黋鰂鬊

merge 黃鮂鲫齍齊

addAliases setAliases setAlias removeAlias hasAlias getAliases getAlias 黃鶇鷾齒齑鱬點

register 黃鼱鬇齒齑鼍麺

addDefinitions removeDefinition getDefinitions setDefinition hasDefinition getDefinition findDefinition 黃鴌鴉鴈鴐鶇鷾

findTaggedServiceIds findTags findUnusedTags 黃齟鮷鶇鷾

龐鱽龯鷏鲊鼎鬀鸼鼎鸃drupal齍齊鶌齱齮麏齍齊鵜鼨鶹麊麉

drupal容器不支持的Symfony容器语法

齍齊鴌鴉鴈鴐dumper齪麏鷆鸼鱤鷛decorated鴌鴉 龓drupal 齍齊鸼鱤鷛龯龬龓鵓麖齣鰎髿鸃Symfony齍齊鲯鳕齦齥鴌鴉鮨鮤pass黇髾鱟

yaml鴣鼩鸼鱤鷛@=鱙鱗龓龯鼂齪鶍鸶鸃drupal鼨髽麊

什么是容器编译

鷓鷒髻髸齍齊鼨鷟鷏齒齑鼍麺龤鲊鼎鯻鰒齪龓鸈鷒鶦麊齟鮷tags鵃鸛齩鼬龓鹹龬鯐髵齪鵠鹰黃鸃鼍鲹麝鷘齮鲦鲥齪麏鷆龓鴀龔髲髰髬鱔龓齩髫髲髰麣龤齩龬齒齑龓drupal鷫髨鼐龐鴌鴉鹀鴄齪髲髰龓黡龔鼍龯龬髲髰齒齑髥鱽髲髰齟鮷鶷鼐龓龯鼂鸃鲦鲥鲹麝齪麏鷆麣鷢麌麊龯龬髲髰龓麪麧鲥龧麁麉龓龤鸃鵹齮鲦鲥髡髟齪麏鷆鳼鲎髟髜龯鷏髲髰髚麿黲黯龤鸃齍齊鳱鸛齪麏鷆麣黑鲏髟髜鶼麉龯鷏髲髰龓鲫麠鸈鷒麼鶡鱢鴈鰈鯠麉鲦鲥髬鱔髲髰鮐鼍麺龓龯龬鷿鷾麣龤齍齊鮨鮤龓髙高齪鰥齍齊鮨鮤麣龤鴓鴐齟鮷鯶鯲鳕魄齒齑鼍麺鼛鬯齪鯸齳龓鸎鴁麌齓齩鷏齍齊鼍麺齪鱢鴈龓髗鼛麣龤鼍齍齊鸆黋齪齒齑鼍麺鶡鷏鬒鬐鷿鷾鷪

在构建容器时,drupal如何给出服务对象的定义数据

鸃鲯鳕齍齊齪麏鷆drupal鸙鸕齒齑體髐鴌鴉鴣鼩services.yml鴣鼩鵡齒齑鳺鲶齊 ServiceProvider 麁龝齍齊鰺麈齒齑鴌鴉鴣鼩龓鯻鹭services.yml黒鴨齒齑鳺鲶齊鷟鷚鼖齪鹀鸬鲀龓龙黯鸻 ServiceProviderInterface 鲣魶龓鼐龐鸜鸛services.yml齪鵞鷟鷿鷾麳龓鰔鼐龐鶇鷾齍齊鮨鮤鷪黒services.yml鵡 ServiceProvider 龤鰙麧麁齪鶳麿龤鸙鸕 Drupal\Core\Extension\ExtensionDiscovery 鸰髌髋鵞鷟齪鳟鳝齉鱙鱗鷫髨髜鶼麁齪龓龯鸆髉髈齩龬鰜鼚鼖鴺鼢鴁鷫髄齪鮳鮯龓鯸龊鷫髨齪點黚龓鼚鼖髂髀骿鷫髨鵞鸃鴣鼩骽點鼆.info.yml鴣鼩點鼆.info.yml鴣鼩鸆黋齪name骻龓鴲鸜 ExtensionDiscovery 鸰齪黯鸻鵻麣鷢鵐鵎鴣鼩骽點鵡鷫髨點鬎鯸龓鴣鼩點鳼龤鷫髨點龓鸆黋齪 name 骻鱨鱨麊龊鵻鵺骹骷鷪

关于服务容器的补充

1黃鸃骰骭鷯鱉鴣鼩鼨鼐龐鷯鱉齱齮麏齍齊鸰龓鴾鴽龤 \Drupal\Core\DependencyInjection\Container 龓鹣鹢黃 $settings['container_base_class']=“\Drupal\模块名\Container 鼊鱟麼鵖鴀龔鯉骡鲊鼎麏鼐龐鱯鱮鴾鴽齪鸰龓鴌鴉齩鷏鼕鲊鼎龓鸙鸕龯龬鷯鱉齱齮麏齍齊麣鼐龐鹀鴌鴉麉鷪

2黃龔鰡鴲齩鴲齱齮麏齍齊齪鴌鴉鴈鴐龤魁麧鼂鹰麿drupal8鵀鳺鲶麉骛鷏黩麊齒齑麿骙麊phpMyAdmin髥鴭鴈鴐鲺龓髜麙 cache_container 鴈鴐鮐龓黎鴼鸆黋齪data黚齥鷽齍龓鯩麙齩龬鱙鱗點龝bin齪鴣鼩龓龙麣龤齍齊鴌鴉鴈鴐齪鲹麝鴣鼩龓鷽齍龤鲏鸕鶀鵠鴘齪龓 unserialize print_r 鶷鼐鴲麙黃

print_r(unserialize(file_get_contents("cache_container-data.bin")));

3黃鸃齍齊鮨鮤齪麏鷆鷟龬鯉骡齪齟鮷黃 { name: service_collector, tag: tags_name, call: add } 龓骊骇龤髟髜鵞鷟齟鮷龝 tags_name 齪齒齑龓鲫麠龙鷒鼸鲩鷾龝骆麌 add 齪鱢鴈龓鸃drupal鼨鷟鷛鼖龯鼂齪麊鸶龓黬黩骅鬖鸷麕

4黃齍齊龯麧鴔龓齒齑鼍麺鵀鸃齍齊鸆黋龓鸃鳊鹌鸆黋鰙麧鷀鯩齍齊麿 \Drupal::getContainer(); 鶷鼐龓鸃drupal鳟鳝 DrupalKernel 鳕魄鸜齱齮麏齍齊鵻龓麣鸊鸈鼱鼭麙麉鷶驿鸰drupal齪體髐麖齣鸆黋黃 \Drupal::setContainer($this->container); 龓龠鰯鵖鼐龐鸃鸸骊驼鸷鷀麙齍齊龓鲫鶹麊鸆黋齪齒齑龓鹭鹫龔鶇鷾鴈鴐鲺龓鷀麙鴈鴐鲺鼍麺龓鳊鹌鹫黎黃 \Drupal::getContainer()->get('database'); 鷶驿鸰Drupal鴢鳺鲶麉鷛鼖黩麊鸷鸶龓鹭鹫鲠鷀鴈鴐鲺鵚鼐龐龯鼂龱黃 \Drupal::database(); 龓龯鼂齪龱鸶鸃鷽鷺麣龤鸙鸕驺黋齪鸷鸶黯鸻齪龓黡鸼鸕鶡麉鳂鴵龓鷚麈鸷麕鶹麊

5黃鼐龐鸃骰骭驳鱉鴣鼩鼨鰺麈services.yml鴣鼩龓龯鸆鰺麈齪services.yml鴣鼩驱鵍鷊鹭齳齲鳺鲶齪鳹龓鹭鹫 /sites/default/services.yml 麣龤鸃驳鱉鴣鼩鼨鰺麈齪龓龙鼐龐驫驧齳齲鳺鲶齪骻龓龠鰯驣驟驜驛齳齲鳺鲶齪齒齑麏鼐龐鶹麊鰯鸷鸶龓鹣鹢龝黃 $settings['container_yamls'][] = '/services.yml';

本书共71小节:

评论 (写第一个评论)