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';

本书共88小节:

评论 (写第一个评论)