New in Symfony 2.2: Finder improvements
Warning: This post is about an unsupported Symfony version. Some of this information may be out of date. Read the most recent Symfony Docs.
The Finder component gives you a nice DSL to let you find files and directories.
name() method restricts files by name; it accepts strings, globs, or
As of Symfony 2.2, you can also restrict files and directories by path, via
path() method, which accepts strings or regexes:
To negate the restriction, use the
Learn more about this new feature in the documentation.
in() method tells the Finder to look for files and directories into
the passed directories. As of 2.2, you can define these directories as globs:
Documentation is available in the Finder component chapter.
Last but not least, and only for some platforms (like Linux, MacOs, and BSD), the Finder performance was greatly improved by converting the criteria to native commands. Have a look at the initial benchmark results that were published when the pull request was submitted.
We need your help for this change as sometimes, the optimized version does not work on some Unix versions; so we need to be sure to exclude those cases and fallback to the PHP adapter. Test on your environment and report if there are any issues.
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.