Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
DynamicCollectionObjectFormatter class
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* @license MIT License
* Object formatter for Propel query
* format() returns one of the following
* - a custom ObjectCollection for a given modal name if the class exists ( ex InvoiceObjectCollection class )
* - the default PropelObjectCollection of Propel model objects
* @author Lee Leathers
* @author Marius Ghita
* @package propel.runtime.collection
class DynamicCollectionObjectFormatter extends PropelObjectFormatter
public function setModalName($modalName)
$this->collectionName = $modalName . "ObjectCollection";
if(false === class_exists($this->collectionName))
$this->collectionName = "PropelObjectCollection";
elseif(false === is_subclass_of($this->collectionName, "PropelObjectCollection"))
throw new LogicException(sprintf(
"%s class must be a subclass of PropelObjectCollection",
return $this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.