<commit_before><?php

class dmRecordLoremizer extends dmConfigurable
{
  protected
  $record,
  $table;
  
  public function __construct(array $options = array())
  {
    $this->initialize($options);
  }
  
  public function getDefaultOptions()
  {
    return array(
      'override' => false,
      'create_associations' => true
    );
  }
  
  protected function initialize(array $options)
  {
    $this->configure($options);
  }
  
  public function execute(dmDoctrineRecord $record)
  {
    $this->record = $record;
    $this->table  = $record->getTable();

//    $this->record->clearRelated();
    
    foreach($this->getLoremizableColumns() as $columnName => $column)
    {
      $this->loremizeColumn($columnName, $column);
    }
    
    if ($this->getOption('create_associations'))
    {
      $this->loremizeAssociations();
    }

    return $this->record;
  }
  
  protected function loremizeColumn($columnName, array $column)
  {
    if ($this->table->isI18nColumn($columnName))
    {
      $defaultValue = $this->table->getI18nTable()->getDefaultValueOf($columnName);
    }
    else<commit_msg>Fix possible issue in record loremizer when modifying existing record<commit_after><?php

class dmRecordLoremizer extends dmConfigurable
{
  protected
  $record,
  $table;
  
  public function __construct(array $options = array())
  {
    $this->initialize($options);
  }
  
  public function getDefaultOptions()
  {
    return array(
      'override' => false,
      'create_associations' => true
    );
  }
  
  protected function initialize(array $options)
  {
    $this->configure($options);
  }
  
  public function execute(dmDoctrineRecord $record)
  {
    $this->record = $record;
    $this->table  = $record->getTable();

    if($this->table->hasI18n())
    {
      $this->record->getCurrentTranslation();
    }

//    $this->record->clearRelated();
    
    foreach($this->getLoremizableColumns() as $columnName => $column)
    {
      $this->loremizeColumn($columnName, $column);
    }
    
    if ($this->getOption('create_associations'))
    {
      $this->loremizeAssociations();
    }

    return $this->record;
  }
  
  protected function loremizeColumn($columnName, array $column)
  {
    if ($this->table->isI18nColumn($columnName))
    {
      $defaultValue = $this->table->getI18nTable()->getDefaultValueOf($columnName);
    }
    else
{'fraction_non_alphanumeric': 0.14358322744599747, 'fraction_numerical': 0.004235493434985175, 'mean_word_length': 3.165784832451499, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, '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': '7657109', 'n_tokens_mistral': 752, 'n_tokens_neox': 741, 'n_words': 126}