<commit_before><?php
class Vpc_Abstract_Admin extends Vps_Component_Abstract_Admin
{
    protected function _getRow($componentId)
    {
        if (!Vpc_Abstract::hasSetting($this->_class, 'tablename')) return null;
        $tablename = Vpc_Abstract::getSetting($this->_class, 'tablename');
        if ($tablename) {
            $table = new $tablename(array('componentClass'=>$this->_class));
            return $table->find($componentId)->current();
        }
        return null;
    }

    protected function _getRows($componentId)
    {
        $tablename = Vpc_Abstract::getSetting($this->_class, 'tablename');
        if ($tablename) {
            $table = new $tablename(array('componentClass' => $this->_class));
            $where = array(
                'component_id = ?' => $componentId
            );
            return $table->fetchAll($where);
        }
        return array();
    }

    public function delete($componentId)
    {
        $row = $this->_getRow($componentId);
        if ($row) {
            $row->delete();
        }
    }

    public function duplicate($source, $target)
    {
        if ($model = $source->getComponent()->getOwnModel()) {
            $row = $model->getRow($source->dbId);
            if ($row) {
                $newRow = $row->duplicate(array(
                    'component_id' => $target->dbId
                ));
            }
        }

        foreach ($source->getChildComponents(array('inherit' => false)) as $c) {
            $c->generator->duplicateChild($c, $target);
        }
    }<commit_msg>Beim duplizieren auch unsichtbare Seiten mitnehmen<commit_after><?php
class Vpc_Abstract_Admin extends Vps_Component_Abstract_Admin
{
    protected function _getRow($componentId)
    {
        if (!Vpc_Abstract::hasSetting($this->_class, 'tablename')) return null;
        $tablename = Vpc_Abstract::getSetting($this->_class, 'tablename');
        if ($tablename) {
            $table = new $tablename(array('componentClass'=>$this->_class));
            return $table->find($componentId)->current();
        }
        return null;
    }

    protected function _getRows($componentId)
    {
        $tablename = Vpc_Abstract::getSetting($this->_class, 'tablename');
        if ($tablename) {
            $table = new $tablename(array('componentClass' => $this->_class));
            $where = array(
                'component_id = ?' => $componentId
            );
            return $table->fetchAll($where);
        }
        return array();
    }

    public function delete($componentId)
    {
        $row = $this->_getRow($componentId);
        if ($row) {
            $row->delete();
        }
    }

    public function duplicate($source, $target)
    {
        if ($model = $source->getComponent()->getOwnModel()) {
            $row = $model->getRow($source->dbId);
            if ($row) {
                $newRow = $row->duplicate(array(
                    'component_id' => $target->dbId
                ));
            }
        }

        foreach ($source->getChildComponents(array('inherit' => false, 'ignoreVisible'=>true)) as $c) {
            $c->generator->duplicateChild($c, $target);
        }
    }
{'fraction_non_alphanumeric': 0.15062893081761006, 'fraction_numerical': 0.0, 'mean_word_length': 2.0913508260447036, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 52, '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': '7020380', 'n_tokens_mistral': 911, 'n_tokens_neox': 897, 'n_words': 156}