All pastes #489607 Raw Edit

Untitled

public text v1 · immutable
·published 2007-05-15 16:57 UTC
rendered paste body
class BaseLocationTag extends sfDoctrineRecordI18n
{
  
  
  public function setTableDefinition()
  {
    $this->setTableName('location_tag');

    $this->hasColumn('created_at', 'timestamp', null, array ());
    $this->hasColumn('author_id', 'integer', 10, array ());
    $this->option('type', 'MyISAM');
  }
  

  
  public function setUp()
  {
    $this->hasOne('User as User', 'LocationTag.author_id', array('foreign' => 'id' ));
    $this->hasMany('LocationTagI18n as LocationTagI18n', 'LocationTagI18n.id' );
    $this->hasMany('Location as locations', 'LocationToTag.location_id' );
    $this->hasI18nTable('LocationTagI18n', 'culture');
  }
  
}

// my query
$q = new Doctrine_Query();    
$tags = $q->select('i18n.*, COUNT(lt.location_id)')
      ->from('LocationTag t, LocationTag.LocationTagI18n i18n, Location.tags lt')
      ->groupby('i18n.tag')
      ->orderby('count DESC')
      ->limit($max)
      ->execute();