Skip to content

Commit 3ce9197

Browse files
committed
Complete reword
1 parent 27dd8f3 commit 3ce9197

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

reference/dic_tags.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ the :class:`Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface` i
363363
// src/Cache/MyCustomWarmer.php
364364
namespace App\Cache;
365365

366+
use App\Foo\Bar;
366367
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
367368

368369
class MyCustomWarmer implements CacheWarmerInterface
@@ -371,16 +372,16 @@ the :class:`Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface` i
371372
{
372373
// ... do some sort of operations to "warm" your cache
373374

374-
// this method must return an array with the file paths of the
375-
// PHP files to preload. If you don't have any, return an empty array
376-
$filesToPreload = [];
375+
$filesAndClassesToPreload = [];
376+
$filesAndClassesToPreload[] = Bar::class;
377+
377378
foreach (scandir($someCacheDir) as $file) {
378379
if (!is_dir($file = $someCacheDir.'/'.$file)) {
379-
$filesToPreload[] = $file;
380+
$filesAndClassesToPreload[] = $file;
380381
}
381382
}
382383

383-
return $filesToPreload;
384+
return $filesAndClassesToPreload;
384385
}
385386

386387
public function isOptional()
@@ -389,6 +390,11 @@ the :class:`Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface` i
389390
}
390391
}
391392

393+
The ``warmUp()`` method must return an array with the files and classes to
394+
preload. Files must be absolute paths and classes must be fully-qualified class
395+
names. The only restriction is that files must be stored in the cache directory.
396+
If you don't need to preload anything, return an empty array
397+
392398
.. deprecated:: 5.1
393399

394400
Not returning an array from the ``warmUp()`` method with the files to

0 commit comments

Comments
 (0)