Example #1
0
 /**
  * Start a collection from a model class
  * @param string $model
  * @return \Virge\ORM\Component\Collection\Collection
  */
 public static function model($model, $alias = '')
 {
     $collection = new Collection();
     $collection->setModel(new $model());
     //set the collection to use the model connection type by default
     $collection->connection($collection->getModel()->_getConnection());
     $table = $collection->getModel()->getSqlTable();
     $collection->setTable($table);
     $collection->setAlias($alias ? $alias : $table);
     return $collection;
 }