Más contenido relacionado La actualidad más candente (20) Similar a News of the Symfony2 World (20) Más de Fabien Potencier (11) News of the Symfony2 World3. Be as easy as possible for newcomers
and as flexible as possible for advanced users
7. use SymfonyComponentsCssSelectorParser;
$document = new DOMDocument();
$document->loadHTMLFile('...');
$xpath = new DOMXPath($document);
$expr = Parser::cssToXpath('a.smart');
$nodes = $xpath->query($expr);
foreach ($nodes as $node)
{
printf("%s (%s)n", $node->nodeValue, $node-
>getAttribute('href'));
}
11. filter()
filterXpath()
eq()
reduce()
first() / last()
siblings()
nextAll() / previousAll()
parents() / children()
22. // fill an input field
$form['name'] = 'Lucas';
// select an option or a radio
$form['country']->select('France');
// tick a checkbox
$form['like_symfony']->tick();
// upload a file
$form['photo']->upload('/path/to/lucas.jpg');
28. $finder
->name('*.php')
->depth('<= 1')
->date('>= yesterday')
->size('<= 1K')
->filter(function (SplFileInfo $file) {
return strlen($file->getBasename()) < 9;
})
;
29. foreach ($finder as $file) {
print $file->getRealpath()."n";
}
$files = iterator_to_array($finder);
$count = iterator_count($finder);
30. use SymfonyComponentsFinderFinder;
$s3 = new Zend_Service_Amazon_S3($key, $sct);
$s3->registerStreamWrapper("s3");
$finder = new Finder();
$finder
->name('photos*')
->size('< 100K')
->date('since 1 hour ago')
->in('s3://bucket-name')
;
38. Sensio S.A.
92-98, boulevard Victor Hugo
92 115 Clichy Cedex
FRANCE
Tél. : +33 1 40 99 80 80
Contact
Fabien Potencier
fabien.potencier at sensio.com
http://www.sensiolabs.com/
http://www.symfony-project.org/
http://fabien.potencier.org/