Skip to content

Instantly share code, notes, and snippets.

@nnarhinen
Created February 8, 2011 20:12
Show Gist options
  • Save nnarhinen/817123 to your computer and use it in GitHub Desktop.
Save nnarhinen/817123 to your computer and use it in GitHub Desktop.
<?php
class MyPropelObjectCollection extends PropelObjectCollection
{
public function each(Closure $callback)
{
foreach ($this as $obj) {
if ($callback($obj) === false) {
break;
}
}
}
}
<?php
class MyPropelObjectFormatter extends PropelObjectFormatter
{
protected $collectionName = 'MyPropelObjectCollection';
}
<?php
MyFooQuery::create()
->filterBySomething('Something')
->setFormatter('MyPropelObjectFormatter')
->find()
->each(function($obj) { //do something });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment