Skip to content

Instantly share code, notes, and snippets.

@cognifloyd
Last active December 23, 2015 05:39
Show Gist options
  • Save cognifloyd/6588549 to your computer and use it in GitHub Desktop.
Save cognifloyd/6588549 to your computer and use it in GitHub Desktop.
This should work.
<?
$bq = new BlobQuery('Acme.FooDerivativePackage');
$bq->from('Acme.BarBoilerplatePackage')
->integrateFiles(array(
'Resources/Private/Templates/FooBar.html' => 'Resources/Private/Templates/Baz.html'
)); // key is the file in the boilerplate, value is the file in the derivative.
// If only the value is given, then the file in the same location is copied from Boilerplate to Derivative.
/** @var $finder \Symfony\Component\Finder\Finder */
$bqfinder = $bq->getFinder();
/** @var $file \SplFileInfo */
foreach($bqfinder as $file) {
//Do something cool to each of the files that were copied into the derivative.
}
//You can also just edit the files that are already in the derivative:
$bq = new BlobQuery('Acme.BazDerivativePackage');
$bq->ofMediaType('text/html')
->in('Resources')
->exclude('Resources/Public');
$bqfinder = $bq->getFinder();
foreach($bqfinder as $file) { /* ... */ }
//Or select a single file.
$bq = new BlobQuery('AmnesiaSpray.Fantastic');
$bq->with('composer.json');
foreach($bq->getFinder() as $file) { /* ... */ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment