<commit_before><?php

/**
 * This class has been auto-generated by the Doctrine ORM Framework
 */
class Section extends BaseSection
{
  public function setTitreComplet($titre) {
    $this->_set('titre_complet', $titre);
    $this->md5 = md5($titre);
    $titres = preg_split('/\s*>\s*/', $titre);
    $parent = null;
    if (count($titres) > 1) {
      $parent_titre = array_shift($titres);
      $parent = doctrine::getTable('Section')->findOneByContexteOrCreateIt($parent_titre);
    }
    $this->_set('titre', $titres[0]);
    $this->save();
    if (!$parent)
      $parent = $this;
    $this->section_id = $parent->id;
    $this->save();
  }
  public function getSubSections() {
    return $q = doctrine::getTable('Section')->createQuery('s')
      ->where('s.section_id = ?', $this->id)
      ->orderBy('s.min_date ASC, s.timestamp ASC')->execute()
      ;
  }
  public function getSeances() {
    $q = doctrine_query::create()
      ->from('Seance s, Section st, Intervention i')
      ->select('s.*')
      ->where('i.seance_id = s.id')
      ->andwhere('i.section_id = st.id')
      ->andwhere('(st.section_id = ? OR i.section_id = ? )', array($this->id, $this->id))
      ->groupBy('s.id')
      ;
    return $q->execute();

    $res_ids = Doctrine::getTable('Section')->createQuery('s')->select('s.id')->where('s.section_id = ? ', $this->id)->fetchArray();
    
    $ids = array($this->id);
    foreach($res_ids as $id) {
      $ids[] = $id['id'];
    }

    $q = Doctrine_Query::create()
      ->select('s.*, i.id')
      ->from('Intervention i, Seance s')
      ->where('i.seance_id = s.id')
      ->whereIn('i.section_id', $ids)
      ->groupBy('i.seance_id')
      ;

    return $q->execute();
  }

  public function updateNbInterventions() {
    $a = Doctrine_Query::create()
      ->select('count(*) as nb')
      ->from('Intervention i')
      ->leftJoin('i.Section s')
      ->where('(i.section_id = ? OR s.section_id = ?)', array($this->id, $this->id))
      ->andWhere('(i.fonction NOT LIKE ? AND i.fonction NOT LIKE ?)', array('président', 'présidente'))
      ->andWhere('i.nb_mots > 20')
      ->fetchArray();
    $this->_set('nb_interventions', $a[0]['nb']);
    $this->save();
  }

  public function getSection($check = 0) {
    if ($this->id == $this->section_id)<commit_msg>un peu fatigué et fait n'importe quoi<commit_after><?php

/**
 * This class has been auto-generated by the Doctrine ORM Framework
 */
class Section extends BaseSection
{
  public function setTitreComplet($titre) {
    $this->_set('titre_complet', $titre);
    $this->md5 = md5($titre);
    $titres = preg_split('/\s*>\s*/', $titre);
    $parent = null;
    if (count($titres) > 1) {
      $parent_titre = array_shift($titres);
      $parent = doctrine::getTable('Section')->findOneByContexteOrCreateIt($parent_titre);
    }
    $this->_set('titre', $titres[0]);
    $this->save();
    if (!$parent)
      $parent = $this;
    $this->section_id = $parent->id;
    $this->save();
  }
  public function getSubSections() {
    return $q = doctrine::getTable('Section')->createQuery('s')
      ->where('s.section_id = ?', $this->id)
      ->orderBy('s.min_date ASC, s.timestamp ASC')->execute()
      ;
  }
  public function getSeances() {
    $q = doctrine_query::create()
      ->from('Seance s, Section st, Intervention i')
      ->select('s.*')
      ->where('i.seance_id = s.id')
      ->andwhere('i.section_id = st.id')
      ->andwhere('(st.section_id = ? OR i.section_id = ? )', array($this->id, $this->id))
      ->groupBy('s.id')
      ;
    return $q->execute();
  }

  public function updateNbInterventions() {
    $a = Doctrine_Query::create()
      ->select('count(*) as nb')
      ->from('Intervention i')
      ->leftJoin('i.Section s')
      ->where('(i.section_id = ? OR s.section_id = ?)', array($this->id, $this->id))
      ->andWhere('(i.fonction NOT LIKE ? AND i.fonction NOT LIKE ?)', array('président', 'présidente'))
      ->andWhere('i.nb_mots > 20')
      ->fetchArray();
    $this->_set('nb_interventions', $a[0]['nb']);
    $this->save();
  }

  public function getSection($check = 0) {
    if ($this->id == $this->section_id)
{'fraction_non_alphanumeric': 0.20982895687786077, 'fraction_numerical': 0.003854492893278728, 'mean_word_length': 3.0987166831194473, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2254123', 'n_tokens_mistral': 1485, 'n_tokens_neox': 1459, 'n_words': 268}