ソースを参照

docs: Correct execute function injector call (#3547)

Hen2609 8 ヶ月 前
コミット
3c74d84dbc
1 ファイル変更3 行追加3 行削除
  1. 3 3
      docs/docs/guides/developer-guide/scheduled-tasks/index.md

+ 3 - 3
docs/docs/guides/developer-guide/scheduled-tasks/index.md

@@ -99,13 +99,13 @@ export const generateSitemapTask = new ScheduledTask({
     schedule: cron => cron.everyDayAt(0, 0),
     schedule: cron => cron.everyDayAt(0, 0),
     // This is the function that will be executed per the schedule.
     // This is the function that will be executed per the schedule.
     async execute({injector, params}) {
     async execute({injector, params}) {
-        // Using `app.get()` we can grab an instance of _any_ provider defined in the
+        // Using `injector.get()` we can grab an instance of _any_ provider defined in the
         // Vendure core as well as by our plugins.
         // Vendure core as well as by our plugins.
-        const sitemapService = app.get(SitemapService);
+        const sitemapService = injector.get(SitemapService);
 
 
         // For most service methods, we'll need to pass a RequestContext object.
         // For most service methods, we'll need to pass a RequestContext object.
         // We can use the RequestContextService to create one.
         // We can use the RequestContextService to create one.
-        const ctx = await app.get(RequestContextService).create({
+        const ctx = await injector.get(RequestContextService).create({
             apiType: 'admin',
             apiType: 'admin',
         });
         });