<commit_before><?php
class Kwc_Abstract_Cards_Generator extends Kwf_Component_Generator_Static
{
    private $_model;

    protected function _getModel()
    {
        if (!$this->_model) {
            $this->_model = Kwc_Abstract::createModel($this->_class);
        }
        return $this->_model;
    }

    protected function _formatSelect($parentData, $select = array())
    {
        //es gibt exakt eine unterkomponente mit der id 'child'
        if ($select->hasPart(Kwf_Component_Select::WHERE_ID)) {
            $select->processed(Kwf_Component_Select::WHERE_ID);
            if ($select->getPart(Kwf_Component_Select::WHERE_ID) != '-child') {
                return null;
            }
        }

        if ($select->hasPart(Kwf_Component_Select::WHERE_COMPONENT_CLASSES)) {
            $cc = $select->getPart(Kwf_Component_Select::WHERE_COMPONENT_CLASSES);
            if (is_array($parentData)) {
            } else {
                $row = $this->_getModel()->getRow($parentData->dbId);
                if (!in_array($this->_settings['component'][$row->component], $cc)) return null;
            }
        }
        return parent::_formatSelect($parentData, $select);
    }
<commit_msg>cards-generator: row must not necessarily exist<commit_after><?php
class Kwc_Abstract_Cards_Generator extends Kwf_Component_Generator_Static
{
    private $_model;

    protected function _getModel()
    {
        if (!$this->_model) {
            $this->_model = Kwc_Abstract::createModel($this->_class);
        }
        return $this->_model;
    }

    protected function _formatSelect($parentData, $select = array())
    {
        //es gibt exakt eine unterkomponente mit der id 'child'
        if ($select->hasPart(Kwf_Component_Select::WHERE_ID)) {
            $select->processed(Kwf_Component_Select::WHERE_ID);
            if ($select->getPart(Kwf_Component_Select::WHERE_ID) != '-child') {
                return null;
            }
        }

        if ($select->hasPart(Kwf_Component_Select::WHERE_COMPONENT_CLASSES)) {
            $cc = $select->getPart(Kwf_Component_Select::WHERE_COMPONENT_CLASSES);
            if (is_array($parentData)) {
            } else {
                $row = $this->_getModel()->getRow($parentData->dbId);
                if (!$row || !in_array($this->_settings['component'][$row->component], $cc)) return null;
            }
        }
        return parent::_formatSelect($parentData, $select);
    }

{'fraction_non_alphanumeric': 0.1325153374233129, 'fraction_numerical': 0.0, 'mean_word_length': 2.539797395079595, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '1056569', 'n_tokens_mistral': 738, 'n_tokens_neox': 702, 'n_words': 116}