Skip to content

Instantly share code, notes, and snippets.

Created October 19, 2012 08:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/3917048 to your computer and use it in GitHub Desktop.
DynamicCollectionObjectFormatter trait
trait DynamicCollectionObjectFormatterTrait
{
public static function create($modelAlias = null, $criteria = null) {
$query = parent::create($modelAlias, $criteria);
$formatter = new DynamicCollectionObjectFormatter();
$formatter->setModalName($query->getModelName());
return $query->setFormatter($formatter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment