<commit_before><?php

namespace cmsadmin\models;

use Yii;

/**
 * Block ActiveRecord contains the Block<->Group relation.
 * 
 * @author <NAME> <<EMAIL>>
 */
class Block extends \admin\ngrest\base\Model
{
    private $cachedDeletedId = 0;

    public static function ngRestApiEndpoint()
    {
        return 'api-cms-block';
    }

    public static function tableName()
    {
        return 'cms_block';
    }
    
    public function ngrestAttributeTypes()
    {
        return [
            'group_id' => ['selectModel', 'modelClass' => BlockGroup::className(), 'valueField' => 'id', 'labelField' => 'name'],
            'class' => 'text',
        ];
    }
    
    public function attributeLabels()
    {
        return [
            'group_id' => 'Group',
            'class' => 'Object Class',
        ];
    }

    public function ngRestConfig($config)
    {
        $this->ngRestConfigDefine($config, ['list'], ['group_id', 'class']);
        
        return $config;
    }

    public function rules()
    {
        return [
            [['class', 'group_id'], 'required'],
        ];
    }

    public function scenarios()
    {
        return [
            'commandinsert' => ['class', 'group_id'],
            'restcreate' => ['class', 'group_id'],
            'restupdate' => ['class', 'group_id'],
        ];
    }

    /**
     * Save id before deleting for clean up in afterDelete()
     *
     * @return bool
     */
    public function beforeDelete()<commit_msg>use group field in blocks model ngrest config.<commit_after><?php

namespace cmsadmin\models;

use Yii;

/**
 * Block ActiveRecord contains the Block<->Group relation.
 * 
 * @author <NAME> <<EMAIL>>
 */
class Block extends \admin\ngrest\base\Model
{
    private $cachedDeletedId = 0;

    public static function ngRestApiEndpoint()
    {
        return 'api-cms-block';
    }

    public static function tableName()
    {
        return 'cms_block';
    }
    
    public function ngrestAttributeTypes()
    {
        return [
            'group_id' => ['selectModel', 'modelClass' => BlockGroup::className(), 'valueField' => 'id', 'labelField' => 'name'],
            'class' => 'text',
        ];
    }
    
    public function attributeLabels()
    {
        return [
            'group_id' => 'Group',
            'class' => 'Object Class',
        ];
    }

    public function ngRestConfig($config)
    {
        $this->ngRestConfigDefine($config, ['list'], ['group_id', 'class']);
        
        return $config;
    }

    public function rules()
    {
        return [
            [['class', 'group_id'], 'required'],
        ];
    }

    public function scenarios()
    {
        return [
            'commandinsert' => ['class', 'group_id'],
            'restcreate' => ['class', 'group_id'],
            'restupdate' => ['class', 'group_id'],
        ];
    }
    
    public function ngRestGroupByField()
    {
        return 'group_id';
    }

    /**
     * Save id before deleting for clean up in afterDelete()
     *
     * @return bool
     */
    public function beforeDelete()
{'fraction_non_alphanumeric': 0.1461038961038961, 'fraction_numerical': 0.0006493506493506494, 'mean_word_length': 1.9768115942028985, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 33, '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': '3853186', 'n_tokens_mistral': 901, 'n_tokens_neox': 882, 'n_words': 209}