<commit_before><?php
class Vpc_Table extends Vps_Db_Table
{
    protected $_rowClass = 'Vpc_Row';
    protected $_componentClass;
    public function __construct($config = array())
    {
        parent::__construct($config);
        if (!isset($config['componentClass'])) {
            throw new Vps_Exception("componentClass is erforderlich für Vpc_Table in config");
        }
        $this->setComponentClass($config['componentClass']);
    }

    public function setComponentClass($c)
    {
        $this->_componentClass = $c;
    }

    public function getComponentClass()
    {
        return $this->_componentClass;
    }

    public function findRow($id)
    {
        $row = $this->find($id)->current();
        if (!$row) {
            $row = $this->createRow();
        }
        return $row;
    }
    public function find($id) {
        $ret = parent::find($id);
        if (!$ret->count()) {
            $data = $this->createRow()->toArray();
            $data['component_id'] = $id;
            $ret = new $this->_rowsetClass(array(
                'table'     => $this,
                'data'      => array($data),
                'readyOnly' => false,
                'rowClass'  => $this->_rowClass,
                'stored'    => false
            ));
        }
        return $ret;
    }
    public function createRow(array $data = array())<commit_msg>bugfix, daten werden sonst bei insert nicht gespeichert<commit_after><?php
class Vpc_Table extends Vps_Db_Table
{
    protected $_rowClass = 'Vpc_Row';
    protected $_componentClass;
    public function __construct($config = array())
    {
        parent::__construct($config);
        if (!isset($config['componentClass'])) {
            throw new Vps_Exception("componentClass is erforderlich für Vpc_Table in config");
        }
        $this->setComponentClass($config['componentClass']);
    }

    public function setComponentClass($c)
    {
        $this->_componentClass = $c;
    }

    public function getComponentClass()
    {
        return $this->_componentClass;
    }

    public function findRow($id)
    {
        $row = $this->find($id)->current();
        if (!$row) {
            $row = $this->createRow();
        }
        return $row;
    }
    public function find($id) {
        $ret = parent::find($id);
        if (!$ret->count()) {
            $data = $this->createRow()->toArray();
            $data['component_id'] = $id;
            $ret = new $this->_rowsetClass(array(
                'table'     => $this,
                'data'      => array($data),
                'readyOnly' => false,
                'rowClass'  => $this->_rowClass,
                'stored'    => false
            ));
            $ret->current()->setFromArray($data); //as in Zend_Db_Table_Abstract::createRow
        }
        return $ret;
    }
    public function createRow(array $data = array())
{'fraction_non_alphanumeric': 0.14444444444444443, 'fraction_numerical': 0.0, 'mean_word_length': 1.9762396694214877, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '6364455', 'n_tokens_mistral': 820, 'n_tokens_neox': 808, 'n_words': 168}