Skip to content

Commit fe24815

Browse files
committed
minor #6652 Finder::path() method matching directories and files (soyuka)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #6652). Discussion ---------- `Finder::path()` method matching directories and files For clarity, adds an example where `path()` is used to match a directory or a file. ref api-platform/core#575 (comment) Commits ------- cd28675 Improve `Finder::path` code example about resulting matches
2 parents 1026863 + cd28675 commit fe24815

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

components/finder.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ Path
206206
Restrict files and directories by path with the
207207
:method:`Symfony\\Component\\Finder\\Finder::path` method::
208208

209-
$finder->path('some/special/dir');
209+
// matches files that contain "data" anywhere in their paths (files or directories)
210+
$finder->path('data');
211+
// for example this will match data/*.xml and data.xml if they exist
212+
$finder->path('data')->name('*.xml');
210213

211214
On all platforms slash (i.e. ``/``) should be used as the directory separator.
212215

0 commit comments

Comments
 (0)